{"id":3397,"date":"2017-08-13T12:08:08","date_gmt":"2017-08-13T09:08:08","guid":{"rendered":"http:\/\/kamil-abzalov.com\/tutorials\/javascript-regular-expressions-part-three\/"},"modified":"2020-04-08T23:41:11","modified_gmt":"2020-04-08T20:41:11","slug":"javascript-regular-expressions-part-three","status":"publish","type":"post","link":"https:\/\/kamil-abzalov.com\/en\/tutorials\/javascript\/javascript-regular-expressions-part-three\/","title":{"rendered":"Javascript. Regular expressions. Part three"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; fullwidth=&#8221;on&#8221; _builder_version=&#8221;3.22&#8243;][et_pb_fullwidth_header title=&#8221;Javascript. Regular expressions. Part three&#8221; content_max_width=&#8221;none&#8221; _builder_version=&#8221;3.16&#8243; button_one_letter_spacing_hover=&#8221;0&#8243; button_two_letter_spacing_hover=&#8221;0&#8243; button_one_text_size__hover_enabled=&#8221;off&#8221; button_two_text_size__hover_enabled=&#8221;off&#8221; button_one_text_color__hover_enabled=&#8221;off&#8221; button_two_text_color__hover_enabled=&#8221;off&#8221; button_one_border_width__hover_enabled=&#8221;off&#8221; button_two_border_width__hover_enabled=&#8221;off&#8221; button_one_border_color__hover_enabled=&#8221;off&#8221; button_two_border_color__hover_enabled=&#8221;off&#8221; button_one_border_radius__hover_enabled=&#8221;off&#8221; button_two_border_radius__hover_enabled=&#8221;off&#8221; button_one_letter_spacing__hover_enabled=&#8221;on&#8221; button_one_letter_spacing__hover=&#8221;0&#8243; button_two_letter_spacing__hover_enabled=&#8221;on&#8221; button_two_letter_spacing__hover=&#8221;0&#8243; button_one_bg_color__hover_enabled=&#8221;off&#8221; button_two_bg_color__hover_enabled=&#8221;off&#8221;][\/et_pb_fullwidth_header][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;3.22&#8243;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;3.25&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; custom_padding=&#8221;0px|||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_dcsbcm_divi_breadcrumbs_module homebreadcrumbtext=&#8221;Home&#8221; hide_currentbreadcrumb=&#8221;off&#8221; _builder_version=&#8221;4.4.2&#8243; custom_padding=&#8221;0px|||&#8221; hover_enabled=&#8221;0&#8243; fontsbreadcrumbs_font_size_tablet=&#8221;51&#8243; fontsbreadcrumbs_line_height_tablet=&#8221;2&#8243; fontsseperator_font_size_tablet=&#8221;51&#8243; fontsseperator_line_height_tablet=&#8221;2&#8243; fontsbreadcrumblinks_font_size_tablet=&#8221;51&#8243; fontsbreadcrumblinks_line_height_tablet=&#8221;2&#8243;][\/et_pb_dcsbcm_divi_breadcrumbs_module][et_pb_text _builder_version=&#8221;3.27.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;]In this lesson we&#8217;ll continue to learn regular expressions.We&#8217;ll talk about quantifiers and two search modes &#8211; greedy and lazy. If you didn&#8217;t see last lessons, I recommend you to watch it:<br \/>\n<a href=\"https:\/\/kamil-abzalov.com\/en\/tutorials\/javascript-jquery-tuts\/javascript-regular-expressions-part-one\/\">here<\/a> \u0438 <a href=\"https:\/\/kamil-abzalov.com\/en\/tutorials\/javascript-jquery-tuts\/javascript-regular-expressions-part-two\/\">here<\/a>.<!--more--><br \/>\n[\/et_pb_text][et_pb_video src=&#8221;https:\/\/www.youtube.com\/watch?v=FQ5wzI_DBk8&#8243; _builder_version=&#8221;3.0.47&#8243;][\/et_pb_video][et_pb_text _builder_version=&#8221;3.27.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221;]Quantifiers in regular expressions are written as <strong>{n}<\/strong>, where n is count of symbols for <strong>searching<\/strong>. Besides we considered some service symbols, which can be written through quantifiers<\/p>\n<p>? &#8211; {0,1} &#8211; zero or one.<br \/>\n* &#8211; {,} &#8211; zero or more than zero<br \/>\n. &#8211; any symbol<\/p>\n<p><strong>Notice:<\/strong> in patternFive example I said search was continuing to the string end. But result was href and class attributes (it was correct).<br \/>\nI forgot to mention with &#8220;greedy&#8221; search in our example &#8220;any symbol&#8221; condition was satisfied to the string end, but quote was not found. That&#8217;s why pattern &#8220;went back&#8221;, searched quote. That&#8217;s why we have got such result.<br \/>\n[\/et_pb_text][et_pb_dmb_code_snippet title=&#8221;Code lesson&#8221; code=&#8221;PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPgogICAgPHRpdGxlPjwvdGl0bGU+CiAgPC9oZWFkPgogIDxib2R5PgogICAgICA8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CiAgICAgICAgLy8g0JrQstCw0L3RgtC40YTQuNC60LDRgtC+0YDRiwogICAgICAgIC8vIHtufSwg0LPQtNC1IG4gLSDQutC+0Lst0LLQviDRgdC40LzQstC+0LvQvtCyCgogICAgICAgIC8vIHZhciBwYXR0ZXJuID0gL1x3XHdcdy8KICAgICAgICB2YXIgcGF0dGVybiA9IC9cd3szfS87CiAgICAgICAgdmFyIHBhdHRlcm5Ud28gPSAvXHd7MywxMH0vOwoKICAgICAgICAvLyA\/ID0gezAsMX0gLSDQvdGD0LvRjCDQuNC70Lgg0L7QtNC40L0KICAgICAgICAvLyAqID0gezAsfSAtINC90YPQu9GMINC40LvQuCDQsdC+0LvQtdC1CiAgICAgICAgLy8gLiAtINC70Y7QsdC+0Lkg0YHQuNC80LLQvtC7CgogICAgICAgIHZhciBzdHIgPSAi0JrQsNC40LvRjCDQutCw0LzQuNC70Yw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90LDRjyDQtNGA0L7QsdGMCiAgICAgICAgMi4g0JTQsNGC0LAg0YTQvtGA0LzQsNGC0LAgKDEwLjA3LjIwMTYpCiAgICAgICAgMy4g0J\/QvtC40YHQuiDQt9Cw0LPQvtC70L7QstC60L7QsiBoMS1oNiDQsiDRgdGC0YDQvtC60LUKCiAgICAgICAgKi8KCgoKICAgICAgPC9zY3JpcHQ+CiAgPC9ib2R5Pgo8L2h0bWw+&#8221; admin_label=&#8221;\u041a\u043e\u0434 \u0443\u0440\u043e\u043a\u0430&#8221; style=&#8221;docco&#8221; linenums=&#8221;on&#8221; usetabwidth=&#8221;on&#8221; tabwidth=&#8221;4&#8243; _builder_version=&#8221;4.4.2&#8243; hover_enabled=&#8221;0&#8243;]PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPgogICAgPHRpdGxlPjwvdGl0bGU+CiAgPC9oZWFkPgogIDxib2R5PgogICAgICA8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CiAgICAgICAgLy8g0JrQstCw0L3RgtC40YTQuNC60LDRgtC+0YDRiwogICAgICAgIC8vIHtufSwg0LPQtNC1IG4gLSDQutC+0Lst0LLQviDRgdC40LzQstC+0LvQvtCyCgogICAgICAgIC8vIHZhciBwYXR0ZXJuID0gL1x3XHdcdy8KICAgICAgICB2YXIgcGF0dGVybiA9IC9cd3szfS87CiAgICAgICAgdmFyIHBhdHRlcm5Ud28gPSAvXHd7MywxMH0vOwoKICAgICAgICAvLyA\/ID0gezAsMX0gLSDQvdGD0LvRjCDQuNC70Lgg0L7QtNC40L0KICAgICAgICAvLyAqID0gezAsfSAtINC90YPQu9GMINC40LvQuCDQsdC+0LvQtdC1CiAgICAgICAgLy8gLiAtINC70Y7QsdC+0Lkg0YHQuNC80LLQvtC7CgogICAgICAgIHZhciBzdHIgPSAi0JrQsNC40LvRjCDQutCw0LzQuNC70Ywga2FtaWwiOwoKICAgICAg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GMCiAgICAgICAgMi4g0JTQsNGC0LAg0YTQvtGA0LzQsNGC0LAgKDEwLjA3LjIwMTYpCiAgICAgICAgMy4g0J\/QvtC40YHQuiDQt9Cw0LPQvtC70L7QstC60L7QsiBoMS1oNiDQsiDRgdGC0YDQvtC60LUKCiAgICAgICAgKi8KCgoKICAgICAgPC9zY3JpcHQ+CiAgPC9ib2R5Pgo8L2h0bWw+[\/et_pb_dmb_code_snippet][et_pb_comments _builder_version=&#8221;4.4.2&#8243; custom_margin=&#8221;30px||||false|false&#8221; hover_enabled=&#8221;0&#8243;][\/et_pb_comments][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson we&#8217;ll continue to learn regular expressions.We&#8217;ll talk about quantifiers and two search modes &#8211; greedy and lazy. If you didn&#8217;t see last lessons, I recommend you to watch it: here \u0438 here. Quantifiers in regular expressions are written as {n}, where n is count of symbols for searching. Besides we considered some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"\u0412 \u044d\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f - \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043a\u0432\u0430\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u043f\u043e\u0438\u0441\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u0432\u0430\u043d\u0442\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b - \u0436\u0430\u0434\u043d\u044b\u0439 \u0438 \u043b\u0435\u043d\u0438\u0432\u044b\u0439. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043f\u0440\u043e\u0448\u043b\u044b\u0435 \u0443\u0440\u043e\u043a\u0438 \u043d\u0430 \u0442\u0435\u043c\u0443 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0445 <a href=\"http:\/\/kamil-abzalov.com\/regexp-in-javascript-part-one\/\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"http:\/\/kamil-abzalov.com\/regexp-in-javascript-part-two\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<!--more-->\r\n\r\nhttps:\/\/www.youtube.com\/watch?v=FQ5wzI_DBk8\r\n\r\n\u041a\u0432\u0430\u043d\u0442\u0438\u0444\u0430\u043a\u0442\u043e\u0440\u044b \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a <strong>{n}, \u0433\u0434\u0435 n - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430<\/strong>.\r\n\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u0432\u0430\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b\r\n\r\n? - {0,1} - \u043d\u0443\u043b\u044c \u0438\u043b\u0438 \u043e\u0434\u0438\u043d\r\n* - {0,} - \u043d\u0443\u043b\u044c \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435\r\n. - \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\r\n\r\n<strong>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 patternFive \u044f \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0432\u0435\u043b\u0438\u0441\u044c \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b href \u0438 class (\u0447\u0442\u043e \u0432\u0435\u0440\u043d\u043e). \u042f \u0437\u0430\u0431\u044b\u043b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0436\u0430\u0434\u043d\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \"\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\" \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u043a\u0430\u0432\u044b\u0447\u043a\u0430 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u0430\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \"\u043f\u043e\u0448\u0435\u043b \u043d\u0430\u0437\u0430\u0434\", \u0438\u0449\u0430 \u0443\u0436\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\r\n\r\n<pre><code><!DOCTYPE html>\r\n<html>\r\n  <head>\r\n    <meta charset=\"utf-8\">\r\n    <title><\/title>\r\n  <\/head>\r\n  <body>\r\n      <script type=\"text\/javascript\">\r\n        \/\/ \u041a\u0432\u0430\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b\r\n        \/\/ {n}, \u0433\u0434\u0435 n - \u043a\u043e\u043b-\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432\r\n\r\n        \/\/ var pattern = \/\\w\\w\\w\/\r\n        var pattern = \/\\w{3}\/;\r\n        var patternTwo = \/\\w{3,10}\/;\r\n\r\n        \/\/ ? = {0,1} - \u043d\u0443\u043b\u044c \u0438\u043b\u0438 \u043e\u0434\u0438\u043d\r\n        \/\/ * = {0,} - \u043d\u0443\u043b\u044c \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435\r\n        \/\/ . - \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\r\n\r\n        var str = \"\u041a\u0430\u0438\u043b\u044c \u043a\u0430\u043c\u0438\u043b\u044c kamil\";\r\n\r\n        var patternThree = \/\u043a\u0430\u043c?\u0438\u043b\u044c\/ig;\r\n        var patternFour = \/\u043a\u0430\u043c*\u0438\u043b\u044c\/ig;\r\n\r\n        console.log(str.match(patternThree));\r\n        console.log(str.match(patternFour));\r\n\r\n        \/\/ \u00a0\u0436\u0430\u0434\u043d\u044b\u0439 \u0438 \u043b\u0435\u043d\u0438\u0432\u044b\u0439 \u0440\u0435\u0436\u0438\u043c\r\n\r\n        var link = '<a href=\"http:\/\/kamil-abzalov.com\" class=\"test\"><\/a>';\r\n\r\n        var patternFive = \/href=\".+\"\/gi; \/\/\u0436\u0430\u0434\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\r\n        var patternSix = \/href=\".+?\"\/gi; \/\/ \u043b\u0435\u043d\u0438\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\r\n        var patternSeven = \/href=\"[^\"]+\"\/gi; \/\/ \u0430\u043d\u0430\u043b\u043e\u0433 \u0436\u0430\u0434\u043d\u043e\u0433\u043e\r\n\r\n        console.log(link.match(patternFive));\r\n        console.log(link.match(patternSix));\r\n        console.log(link.match(patternSeven));\r\n\r\n\r\n        \/*\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0437\u043c\u0438\u043d\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430:\r\n\r\n        1. \u0414\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0430\u044f \u0434\u0440\u043e\u0431\u044c\r\n        2. \u0414\u0430\u0442\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 (10.07.2016)\r\n        3. \u041f\u043e\u0438\u0441\u043a \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 h1-h6 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435\r\n\r\n        *\/\r\n\r\n\r\n\r\n      <\/script>\r\n  <\/body>\r\n<\/html>\r\n<\/code><\/pre>","_et_gb_content_width":"","footnotes":""},"categories":[256,219],"tags":[230],"class_list":["post-3397","post","type-post","status-publish","format-standard","hentry","category-javascript","category-tutorials","tag-javascript-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Javascript. Regular expressions. Part three - Kamil Abzalov&#039;s blog<\/title>\n<meta name=\"description\" content=\"In this lesson we&#039;ll continue to consider learning of regular expressions. We&#039;ll consider quantifiers and two search modes - greedy and lazy\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Javascript. Regular expressions. Part three - Kamil Abzalov&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"In this lesson we&#039;ll continue to consider learning of regular expressions. We&#039;ll consider quantifiers and two search modes - greedy and lazy\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0441\u0430\u0439\u0442 \u041a\u0430\u043c\u0438\u043b\u044f \u0410\u0431\u0437\u0430\u043b\u043e\u0432\u0430\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/kamabzalov\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-13T09:08:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-08T20:41:11+00:00\" \/>\n<meta name=\"author\" content=\"Kamil&#039; Abzalov\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Javascript. Regular expressions\" \/>\n<meta name=\"twitter:description\" content=\"In this lesson we&#039;ll continue to consider learning of regular expressions. We&#039;ll consider quantifiers and two search modes - greedy and lazy\" \/>\n<meta name=\"twitter:creator\" content=\"@kamabzalov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kamil&#039; Abzalov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/\"},\"author\":{\"name\":\"Kamil' Abzalov\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/#\\\/schema\\\/person\\\/9c53360f21b83306ba40c2231573c600\"},\"headline\":\"Javascript. Regular expressions. Part three\",\"datePublished\":\"2017-08-13T09:08:08+00:00\",\"dateModified\":\"2020-04-08T20:41:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/\"},\"wordCount\":1021,\"commentCount\":0,\"keywords\":[\"javascript\"],\"articleSection\":[\"JavaScript\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/\",\"url\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/\",\"name\":\"Javascript. Regular expressions. Part three - Kamil Abzalov's blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/#website\"},\"datePublished\":\"2017-08-13T09:08:08+00:00\",\"dateModified\":\"2020-04-08T20:41:11+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/#\\\/schema\\\/person\\\/9c53360f21b83306ba40c2231573c600\"},\"description\":\"In this lesson we'll continue to consider learning of regular expressions. We'll consider quantifiers and two search modes - greedy and lazy\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/videouroki\\\/javascript\\\/regexp-in-javascript-part-three\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\\\/\\\/kamil-abzalov.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Javascript. Regular expressions. Part three\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/#website\",\"url\":\"https:\\\/\\\/kamil-abzalov.com\\\/\",\"name\":\"\u0441\u0430\u0439\u0442 \u041a\u0430\u043c\u0438\u043b\u044f \u0410\u0431\u0437\u0430\u043b\u043e\u0432\u0430\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kamil-abzalov.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kamil-abzalov.com\\\/#\\\/schema\\\/person\\\/9c53360f21b83306ba40c2231573c600\",\"name\":\"Kamil' Abzalov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g\",\"caption\":\"Kamil' Abzalov\"},\"sameAs\":[\"https:\\\/\\\/kamil-abzalov.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/kamabzalov\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/kamabzalov\",\"https:\\\/\\\/x.com\\\/kamabzalov\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/kamabzalov\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Javascript. Regular expressions. Part three - Kamil Abzalov's blog","description":"In this lesson we'll continue to consider learning of regular expressions. We'll consider quantifiers and two search modes - greedy and lazy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/","og_locale":"en_US","og_type":"article","og_title":"Javascript. Regular expressions. Part three - Kamil Abzalov's blog","og_description":"In this lesson we'll continue to consider learning of regular expressions. We'll consider quantifiers and two search modes - greedy and lazy","og_url":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/","og_site_name":"\u0441\u0430\u0439\u0442 \u041a\u0430\u043c\u0438\u043b\u044f \u0410\u0431\u0437\u0430\u043b\u043e\u0432\u0430","article_author":"https:\/\/www.facebook.com\/kamabzalov","article_published_time":"2017-08-13T09:08:08+00:00","article_modified_time":"2020-04-08T20:41:11+00:00","author":"Kamil' Abzalov","twitter_card":"summary_large_image","twitter_title":"Javascript. Regular expressions","twitter_description":"In this lesson we'll continue to consider learning of regular expressions. We'll consider quantifiers and two search modes - greedy and lazy","twitter_creator":"@kamabzalov","twitter_misc":{"Written by":"Kamil' Abzalov","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/#article","isPartOf":{"@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/"},"author":{"name":"Kamil' Abzalov","@id":"https:\/\/kamil-abzalov.com\/#\/schema\/person\/9c53360f21b83306ba40c2231573c600"},"headline":"Javascript. Regular expressions. Part three","datePublished":"2017-08-13T09:08:08+00:00","dateModified":"2020-04-08T20:41:11+00:00","mainEntityOfPage":{"@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/"},"wordCount":1021,"commentCount":0,"keywords":["javascript"],"articleSection":["JavaScript","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/","url":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/","name":"Javascript. Regular expressions. Part three - Kamil Abzalov's blog","isPartOf":{"@id":"https:\/\/kamil-abzalov.com\/#website"},"datePublished":"2017-08-13T09:08:08+00:00","dateModified":"2020-04-08T20:41:11+00:00","author":{"@id":"https:\/\/kamil-abzalov.com\/#\/schema\/person\/9c53360f21b83306ba40c2231573c600"},"description":"In this lesson we'll continue to consider learning of regular expressions. We'll consider quantifiers and two search modes - greedy and lazy","breadcrumb":{"@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kamil-abzalov.com\/videouroki\/javascript\/regexp-in-javascript-part-three\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/kamil-abzalov.com\/en\/"},{"@type":"ListItem","position":2,"name":"Javascript. Regular expressions. Part three"}]},{"@type":"WebSite","@id":"https:\/\/kamil-abzalov.com\/#website","url":"https:\/\/kamil-abzalov.com\/","name":"\u0441\u0430\u0439\u0442 \u041a\u0430\u043c\u0438\u043b\u044f \u0410\u0431\u0437\u0430\u043b\u043e\u0432\u0430","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kamil-abzalov.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kamil-abzalov.com\/#\/schema\/person\/9c53360f21b83306ba40c2231573c600","name":"Kamil' Abzalov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3ad2daebcb3a4d03f8573b49054a003cd26a151ecc58ccfccc75b823131d1ead?s=96&d=mm&r=g","caption":"Kamil' Abzalov"},"sameAs":["https:\/\/kamil-abzalov.com\/","https:\/\/www.facebook.com\/kamabzalov","https:\/\/www.linkedin.com\/in\/kamabzalov","https:\/\/x.com\/kamabzalov","https:\/\/www.youtube.com\/user\/kamabzalov"]}]}},"_links":{"self":[{"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/posts\/3397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/comments?post=3397"}],"version-history":[{"count":8,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/posts\/3397\/revisions"}],"predecessor-version":[{"id":31843,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/posts\/3397\/revisions\/31843"}],"wp:attachment":[{"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/media?parent=3397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/categories?post=3397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kamil-abzalov.com\/en\/wp-json\/wp\/v2\/tags?post=3397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}