{"id":261,"date":"2020-03-27T14:43:48","date_gmt":"2020-03-27T12:43:48","guid":{"rendered":"https:\/\/lyubomir-angelov.com\/?post_type=resource&#038;p=261"},"modified":"2020-03-27T14:43:48","modified_gmt":"2020-03-27T12:43:48","slug":"the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge","status":"publish","type":"resource","link":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/","title":{"rendered":"The one thing I always stumble on regardless of how long I&#8217;ve been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you&#8217;ll get different results"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/twitter.com\/marvinhagemeist\/status\/1243072397806313472?s=20\">https:\/\/twitter.com\/marvinhagemeist\/status\/1243072397806313472?s=20 <\/a><\/p>\n","protected":false},"featured_media":0,"template":"","meta":[],"tags":[36,46],"class_list":["post-261","resource","type-resource","status-publish","hentry","tag-javascript","tag-regex"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The one thing I always stumble on regardless of how long I&#039;ve been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you&#039;ll get different results - Lyubomir Angelov<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The one thing I always stumble on regardless of how long I&#039;ve been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you&#039;ll get different results - Lyubomir Angelov\" \/>\n<meta property=\"og:description\" content=\"https:\/\/twitter.com\/marvinhagemeist\/status\/1243072397806313472?s=20\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/\" \/>\n<meta property=\"og:site_name\" content=\"Lyubomir Angelov\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@angelovcode\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/\",\"name\":\"The one thing I always stumble on regardless of how long I've been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you'll get different results - Lyubomir Angelov\",\"isPartOf\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\"},\"datePublished\":\"2020-03-27T12:43:48+00:00\",\"dateModified\":\"2020-03-27T12:43:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lyubomir-angelov.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The one thing I always stumble on regardless of how long I&#8217;ve been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you&#8217;ll get different results\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#website\",\"url\":\"https:\/\/lyubomir-angelov.com\/blog\/\",\"name\":\"Lyubomir Angelov\",\"description\":\"The life of a Manager\",\"publisher\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92\",\"name\":\"Lyubomir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g\",\"caption\":\"Lyubomir\"},\"logo\":{\"@id\":\"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/angelovcode\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The one thing I always stumble on regardless of how long I've been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you'll get different results - Lyubomir Angelov","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:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/","og_locale":"en_US","og_type":"article","og_title":"The one thing I always stumble on regardless of how long I've been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you'll get different results - Lyubomir Angelov","og_description":"https:\/\/twitter.com\/marvinhagemeist\/status\/1243072397806313472?s=20","og_url":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/","og_site_name":"Lyubomir Angelov","twitter_card":"summary_large_image","twitter_site":"@angelovcode","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/","url":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/","name":"The one thing I always stumble on regardless of how long I've been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you'll get different results - Lyubomir Angelov","isPartOf":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#website"},"datePublished":"2020-03-27T12:43:48+00:00","dateModified":"2020-03-27T12:43:48+00:00","breadcrumb":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/lyubomir-angelov.com\/blog\/resource\/the-one-thing-i-always-stumble-on-regardless-of-how-long-ive-been-working-with-javascript-is-that-any-regex-with-the-global-modifier-is-stateful-if-you-do-use-it-twice-on-the-same-string-youll-ge\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lyubomir-angelov.com\/blog\/"},{"@type":"ListItem","position":2,"name":"The one thing I always stumble on regardless of how long I&#8217;ve been working with JavaScript is that any regex with the global modifier is stateful. If you do use it twice on the same string you&#8217;ll get different results"}]},{"@type":"WebSite","@id":"https:\/\/lyubomir-angelov.com\/blog\/#website","url":"https:\/\/lyubomir-angelov.com\/blog\/","name":"Lyubomir Angelov","description":"The life of a Manager","publisher":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lyubomir-angelov.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/5e091f5c2fa79f57d30d482a7ef8cd92","name":"Lyubomir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f6b8c15868355fa857fad18647aeadd07814e3d9baa72a1c92e718056684fec7?s=96&d=mm&r=g","caption":"Lyubomir"},"logo":{"@id":"https:\/\/lyubomir-angelov.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/twitter.com\/angelovcode"]}]}},"_links":{"self":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/resources\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/resources"}],"about":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/types\/resource"}],"wp:attachment":[{"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyubomir-angelov.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}