{"id":281,"date":"2020-01-19T18:12:43","date_gmt":"2020-01-19T17:12:43","guid":{"rendered":"http:\/\/blog.mhasin.eu\/?p=281"},"modified":"2020-01-19T18:12:43","modified_gmt":"2020-01-19T17:12:43","slug":"mysql-vycitanie-cisla-z-textu-text-cislo-pomocou-regext","status":"publish","type":"post","link":"https:\/\/blog.mhasin.eu\/?p=281","title":{"rendered":"MYSQL vy\u010d\u00edtanie \u010d\u00edsla z textu  *text:  cislo* pomocou regext"},"content":{"rendered":"\n<p>Pre vy\u010d\u00edtanie a porovnanie \u010d\u00edsla v tabu\u013eke s hodnotami je mo\u017ene pou\u017ei\u0165 regexp a substring_index<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>drop table if exists t;\ncreate table t (col varchar(100));\ninsert into t values ('Description Number 9 MOre description');\ninsert into t values ('Description Number 549 MOre description');\ninsert into t values ('Description Number 549 MOre description');\ninsert into t values ('Description Number asd MOre description');\n\n\nselect \n    case \n        when col regexp '.*Number &#91;0-9]+.*' \n        then substring_index(substring_index(col, 'Number ', -1), ' ', 1)\n    end \nfrom t;<\/code><\/pre>\n\n\n\n<p>Vyst\u00fap funkcie:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"954\" height=\"142\" src=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/01\/image-3.png\" alt=\"\" class=\"wp-image-282\" srcset=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/01\/image-3.png 954w, https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/01\/image-3-300x45.png 300w, https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/01\/image-3-768x114.png 768w\" sizes=\"auto, (max-width: 954px) 100vw, 954px\" \/><\/figure>\n\n\n\n<p>Live k\u00f3d:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;rextester.com\/EJX96105<\/code><\/pre>\n<div class=\"pdf24Plugin-cp\"> \t<form name=\"pdf24Form0\" method=\"post\" action=\"https:\/\/doc2pdf.pdf24.org\/wordpress.php\" target=\"pdf24PopWin\" onsubmit=\"var pdf24Win = window.open('about:blank', 'pdf24PopWin', 'resizable=yes,scrollbars=yes,width=600,height=250,left='+(screen.width\/2-300)+',top='+(screen.height\/3-125)+''); pdf24Win.focus(); if(typeof pdf24OnCreatePDF === 'function'){void(pdf24OnCreatePDF(this,pdf24Win));}\"> \t\t<input type=\"hidden\" name=\"blogCharset\" value=\"Cw1x07UAAA==\" \/><input type=\"hidden\" name=\"blogPosts\" value=\"MwQA\" \/><input type=\"hidden\" name=\"blogUrl\" value=\"yygpKSi20tdPyslP18vNSCzOzNNLLQUA\" \/><input type=\"hidden\" name=\"blogName\" value=\"c\/LxdwcA\" \/><input type=\"hidden\" name=\"blogValueEncoding\" value=\"gzdeflate base64\" \/><input type=\"hidden\" name=\"postId_0\" value=\"M7IwBAA=\" \/><input type=\"hidden\" name=\"postTitle_0\" value=\"840MDvRRKKs80nt4bUliXmaqAohVnJOoUKVQklpRUqqgoAWirRQUkjOLc\/K1FAryc\/OT80sVilLTgeIA\" \/><input type=\"hidden\" name=\"postLink_0\" value=\"yygpKSi20tdPyslP18vNSCzOzNNLLdW3L7A1sjAEAA==\" \/><input type=\"hidden\" name=\"postAuthor_0\" value=\"y00syfcwNAIA\" \/><input type=\"hidden\" name=\"postDateTime_0\" value=\"MzIwMtA1MNQ1tFQwtLAyMLQyMQYA\" \/><input type=\"hidden\" name=\"postContent_0\" value=\"xVTLctMwFN37K+6oM01S4thOnbZ5rmDD8FoxbBhGkW9sEVvSSLLj9B\/4DJas2LHoJs1\/ITuBQqcLoAu0cO6NfM851jm2N1OLNxqh2t5+2n2xVHAECkpqWYm2af42OYUKLF2WtzdrBAOZTIS0tODwEaGQ+xuBbqbc3\/D9Z9CYYq0ciimXxmou0g9cJFjPArXw3Jopx8dyasycbJS\/zCVb+0wmSBaz5meRaKkathyBrwBrbqwBO\/WYRmrxuGOhy2QOFdUso7obhWGvN\/W4MKgtcGGlu6OieYkGup2naJjmynIp4FVZLFHDGF6+djqSu53OX82P4v+PQE3yIILnGcyRWfDALUYNHqpmbTIU0Jzc0abO4OyIdnoyjqahP37\/ZHDWuRuwzcA9K7v3ewfYh84RqNMHP+q5vqmiXouEIgFvpWXhjJwFrc0uDxqPiVi83Rq7+6ZgVYo14zj5GZYVT8sH8sILmrok8mv0c6rTJju8SCGXNHGq5iSn11vizsUxtT01W8EIbHhiszkZj2ICGfI0s3MSxUMCRrM5yaxVZhIEjiIdFBk1XAywDBwpk8KisEGpGgYTDMNhGIRR0MrwzwdKpARo7tDIL1IPu8OrA75B+0gKcLo3ffhnDP88DOt41EK58lFQlxdXdRTFLZarN6Q1wz03La3sQ7egtd+e9qRRreoeuFe0cpRtRyBw\/h+8\/RGBF7xCWO++JpM\/\/lIc5J+exJfT9qKxtmgs6gGTRfDs+bvxRRSOfs\/bdw==\" \/> \t\t<a href=\"https:\/\/www.pdf24.org\" target=\"_blank\" title=\"www.pdf24.org\" rel=\"nofollow\"><img src=\"https:\/\/blog.mhasin.eu\/wp-content\/plugins\/pdf24-post-to-pdf\/img\/pdf_32x32.png\" alt=\"\" border=\"0\" height=\"32\" \/><\/a> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<span class=\"pdf24Plugin-cp-text\">Send article as PDF<\/span> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<input class=\"pdf24Plugin-cp-input\" style=\"margin: 0px;\" type=\"text\" name=\"sendEmailTo\" placeholder=\"Enter email address\" \/> \t\t<input class=\"pdf24Plugin-cp-submit\" style=\"margin: 0px;\" type=\"submit\" value=\"Send\" \/> \t<\/form> <\/div>","protected":false},"excerpt":{"rendered":"Pre vy\u010d\u00edtanie a porovnanie \u010d\u00edsla v tabu\u013eke s hodnotami je mo\u017ene pou\u017ei\u0165 regexp a substring_index Vyst\u00fap funkcie: Live k\u00f3d: &nbsp;&nbsp; Send article as PDF &nbsp;&nbsp;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"arc_restricted_post":false,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-programovanie"],"_links":{"self":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281"}],"version-history":[{"count":1,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}