{"id":60044,"date":"2019-02-09T04:19:10","date_gmt":"2019-02-09T11:19:10","guid":{"rendered":"http:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/"},"modified":"2019-02-09T04:19:10","modified_gmt":"2019-02-09T11:19:10","slug":"new-javascript-features-that-will-change-how-you-write-regex","status":"publish","type":"post","link":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/","title":{"rendered":"New JavaScript Features That Will Change How You Write Regex"},"content":{"rendered":"<link rel=\"canonical\" href=\"https:\/\/www.smashingmagazine.com\/2019\/02\/regexp-features-regular-expressions\/\"><title>New JavaScript Features That Will Change How You Write Regex<\/title><\/p>\n<article>\n<header>\n<h1>New JavaScript Features That Will Change How You Write Regex<\/h1>\n<address>Faraz Kelhini<\/address>\n<p>                  <time datetime=\"2019-02-08T13:00:32+01:00\">2019-02-08T13:00:32+01:00<\/time><time datetime=\"2019-02-09T11:04:59+00:00\">2019-02-09T11:04:59+00:00<\/time><\/header>\n<p>There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished with a single line of regular expression code. While the built-in functions in most languages are usually sufficient to perform search and replace operations on strings, more complex operations \u2014 such as validating text inputs \u2014 often require the use of regular expressions.<\/p>\n<p>Regular expressions have been part of the JavaScript language since the third edition of the ECMAScript standard, which was introduced in 1999. ECMAScript 2018 (or ES2018 for short) is the ninth edition of the standard and further improves the text processing capability of JavaScript by introducing four new features:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/articles\/#lookbehind-assertions\">Lookbehind assertions<\/a><\/li>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/articles\/#named-capture-groups\">Named capture groups<\/a><\/li>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/articles\/#s-dotAll-flag\"><code>s<\/code> (<code>dotAll<\/code>) Flag<\/a><\/li>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/articles\/#unicode-property-escapes\">Unicode property escapes<\/a><\/li>\n<\/ul>\n<p>These new features are explained in detail in the subsections that follow.<\/p>\n<div>\n<h4>Debugging JavaScript<\/h4>\n<p><code>console.log<\/code> can tell you a lot about your app, but it can&#8217;t truly debug your code. For that, you need a full-fledged JavaScript debugger. <a href=\"https:\/\/www.smashingmagazine.com\/2018\/02\/javascript-firefox-debugger\/\">Read more\u00a0?<\/a><\/p>\n<\/div>\n<aside data-audience=\"non-subscriber\">\n<div>\n<div>\n<p>Web forms are such an important part of the web, but <strong>we design them poorly all the time<\/strong>. The brand-new \u201cForm Design Patterns\u201d book is our new practical guide for people who <strong>design, prototype<\/strong> and <strong>build<\/strong> all sorts of forms for digital services, products and websites. The eBook is <em>free<\/em> for <a href=\"https:\/\/www.smashingmagazine.com\/membership\/#plans\">Smashing\u00a0Members<\/a>.<\/p>\n<p>    <a href=\"https:\/\/www.smashingmagazine.com\/2018\/10\/form-design-patterns-release\/\"><br \/>\n      Check the table of contents\u00a0?<br \/>\n    <\/a>\n      <\/div>\n<div>\n        <a href=\"https:\/\/www.smashingmagazine.com\/2018\/10\/form-design-patterns-release\/\"><\/p>\n<div>\n          <img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/02\/form-design-patterns-shop-image.png?resize=310%2C400\" alt=\"Form Design Patterns \u2014 a practical guide for anyone who needs to design and code web forms\" width=\"310\" height=\"400\"><\/div>\n<p>      <\/a>\n      <\/div>\n<\/p><\/div>\n<\/aside>\n<h3>Lookbehind Assertions<\/h3>\n<p>The ability to match a sequence of characters based on what follows or precedes it enables you to discard potentially undesired matches. This is especially important when you need to process a large string and the chance of undesired matches is high. Fortunately, most regular expression flavors provide the lookbehind and lookahead assertions for this purpose.<\/p>\n<p>Prior to ES2018, only lookahead assertions were available in JavaScript. A lookahead allows you to assert that a pattern is immediately followed by another pattern.<\/p>\n<p>There are two versions of lookahead assertions: positive and negative. The syntax for a positive lookahead is <code>(?=...)<\/code>. For example, the regex <code>\/Item(?= 10)\/<\/code> matches <code>Item<\/code> only when it is followed, with an intervening space, by number 10:<\/p>\n<pre><code>const re = \/Item(?= 10)\/;\n\nconsole.log(re.exec('Item'));\n\/\/ ? null\n\nconsole.log(re.exec('Item5'));\n\/\/ ? null\n\nconsole.log(re.exec('Item 5'));\n\/\/ ? null\n\nconsole.log(re.exec('Item 10'));\n\/\/ ? [\"Item\", index: 0, input: \"Item 10\", groups: undefined]\n<\/code><\/pre>\n<p>This code uses the <code>exec()<\/code> method to search for a match in a string. If a match is found, <code>exec()<\/code> returns an array whose first element is the matched string. The <code>index<\/code> property of the array holds the index of the matched string, and the <code>input<\/code> property holds the entire string that the search performed on. Finally, if named capture groups are used in the regular expression, they are placed on the <code>groups<\/code> property. In this case, <code>groups<\/code> has a value of <code>undefined<\/code> because there is no named capture group.<\/p>\n<p>The construct for a negative lookahead is <code>(?!...)<\/code>. A negative lookahead asserts that a pattern is not followed by a specific pattern. For example, the pattern <code>\/Red(?!head)\/<\/code> matches <code>Red<\/code> only if it not followed by <code>head<\/code>:<\/p>\n<pre><code>const re = \/Red(?!head)\/;\n\nconsole.log(re.exec('Redhead'));\n\/\/ ? null\n\nconsole.log(re.exec('Redberry'));\n\/\/ ? [\"Red\", index: 0, input: \"Redberry\", groups: undefined]\n\nconsole.log(re.exec('Redjay'));\n\/\/ ? [\"Red\", index: 0, input: \"Redjay\", groups: undefined]\n\nconsole.log(re.exec('Red'));\n\/\/ ? [\"Red\", index: 0, input: \"Red\", groups: undefined]\n<\/code><\/pre>\n<p>ES2018 complements lookahead assertions by bringing lookbehind assertions to JavaScript. Denoted by <code>(?<=...)<\/code>, a lookbehind assertion allows you to match a pattern only if it is preceded by another pattern.<\/p>\n<p>Let\u2019s suppose you need to retrieve the price of a product in euro without capturing the euro symbol. With a lookbehind, this task becomes a lot simpler:<\/p>\n<pre><code>const re = \/(?<=\u20ac)d+(.d*)?\/;\n\nconsole.log(re.exec('199'));\n\/\/ ? null\n\nconsole.log(re.exec('$199'));\n\/\/ ? null\n\nconsole.log(re.exec('\u20ac199'));\n\/\/ ? [\"199\", undefined, index: 1, input: \"\u20ac199\", groups: undefined]\n<\/code><\/pre>\n<p><strong>Note<\/strong>: <em>Lookahead and lookbehind assertions are often referred to as \u201clookarounds\u201d.<\/em><\/p>\n<p>The negative version of lookbehind is denoted by <code>(?<!...)<\/code> and enables you to match a pattern that is not preceded by the pattern specified within the lookbehind. For example, the regular expression <code>\/(?<!d{3}) meters\/<\/code> matches the word \u201cmeters\u201d if three digits do not come before it:<\/p>\n<pre><code>const re = \/(?<!d{3}) meters\/;\n\nconsole.log(re.exec('10 meters'));\n\/\/ ? [\" meters\", index: 2, input: \"10 meters\", groups: undefined]\n\nconsole.log(re.exec('100 meters'));    \n\/\/ ? null\n<\/code><\/pre>\n<p>As with lookaheads, you can use several lookbehinds (negative or positive) in succession to create a more complex pattern. Here\u2019s an example:<\/p>\n<pre><code>const re = \/(?<=d{2})(?<!35) meters\/;\n\nconsole.log(re.exec('35 meters'));\n\/\/ ? null\n\nconsole.log(re.exec('meters'));\n\/\/ ? null\n\nconsole.log(re.exec('4 meters'));\n\/\/ ? null\n\nconsole.log(re.exec('14 meters'));\n\/\/ ? [\"meters\", index: 2, input: \"14 meters\", groups: undefined]\n<\/code><\/pre>\n<p>This regex matches a string containing meters only if it is immediately preceded by any two digits other than 35. The positive lookbehind ensures that the pattern is preceded by two digits, and then the negative lookbehind ensures that the digits are not 35.<\/p>\n<div><\/div>\n<h3>Named Capture Groups<\/h3>\n<p>You can group a part of a regular expression by encapsulating the characters in parentheses. This allows you to restrict alternation to a part of the pattern or apply a quantifier on the whole group. Furthermore, you can extract the matched value by parentheses for further processing.<\/p>\n<p>The following code gives an example of how to find a file name with <em>.jpg<\/em> extension in a string and then extract the file name:<\/p>\n<pre><code>const re = \/(w+).jpg\/;\nconst str = 'File name: cat.jpg';\nconst match = re.exec(str);\nconst fileName = match[1];\n\n\/\/ The second element in the resulting array holds the portion of the string that parentheses matched\nconsole.log(match);\n\/\/ ? [\"cat.jpg\", \"cat\", index: 11, input: \"File name: cat.jpg\", groups: undefined]\n\nconsole.log(fileName);\n\/\/ ? cat\n<\/code><\/pre>\n<p>In more complex patterns, referencing a group using a number just makes the already cryptic regular expression syntax more confusing. For example, suppose you want to match a date. Since the position of day and month is swapped in some regions, it\u2019s not clear which group refers to the month and which group refers to the day:<\/p>\n<pre><code>const re = \/(d{4})-(d{2})-(d{2})\/;\nconst match = re.exec('2020-03-04');\n\nconsole.log(match[0]);    \/\/ ? 2020-03-04\nconsole.log(match[1]);    \/\/ ? 2020\nconsole.log(match[2]);    \/\/ ? 03\nconsole.log(match[3]);    \/\/ ? 04\n<\/code><\/pre>\n<p>ES2018\u2019s solution to this problem is named capture groups, which use a more expressive syntax in the form of <code>(?<name>...)<\/code>:<\/p>\n<pre><code>const re = \/(?<year>d{4})-(?<month>d{2})-(?<day>d{2})\/;\nconst match = re.exec('2020-03-04');\n\nconsole.log(match.groups);          \/\/ ? {year: \"2020\", month: \"03\", day: \"04\"}\nconsole.log(match.groups.year);     \/\/ ? 2020\nconsole.log(match.groups.month);    \/\/ ? 03\nconsole.log(match.groups.day);      \/\/ ? 04\n<\/code><\/pre>\n<p>Because the resulting object may contain a property with the same name as a named group, all named groups are defined under a separate object called <code>groups<\/code>.<\/p>\n<p>A similar construct exists in many new and traditional programming languages. Python, for example, uses the <code>(?P<name>)<\/code> syntax for named groups. Not surprisingly, Perl supports named groups with syntax identical to JavaScript (JavaScript has imitated its regular expression syntax from Perl). Java also uses the same syntax as Perl.<\/p>\n<p>In addition to being able to access a named group through the <code>groups<\/code> object, you can access a group using a numbered reference \u2014 similar to a regular capture group:<\/p>\n<pre><code>const re = \/(?<year>d{4})-(?<month>d{2})-(?<day>d{2})\/;\nconst match = re.exec('2020-03-04');\n\nconsole.log(match[0]);    \/\/ ? 2020-03-04\nconsole.log(match[1]);    \/\/ ? 2020\nconsole.log(match[2]);    \/\/ ? 03\nconsole.log(match[3]);    \/\/ ? 04\n<\/code><\/pre>\n<p>The new syntax also works well with destructuring assignment:<\/p>\n<pre><code>const re = \/(?<year>d{4})-(?<month>d{2})-(?<day>d{2})\/;\nconst [match, year, month, day] = re.exec('2020-03-04');\n\nconsole.log(match);    \/\/ ? 2020-03-04\nconsole.log(year);     \/\/ ? 2020\nconsole.log(month);    \/\/ ? 03\nconsole.log(day);      \/\/ ? 04\n<\/code><\/pre>\n<p>The <code>groups<\/code> object is always created, even if no named group exists in a regular expression:<\/p>\n<pre><code>const re = \/d+\/;\nconst match = re.exec('123');\n\nconsole.log('groups' in match);    \/\/ ? true\n<\/code><\/pre>\n<p>If an optional named group does not participate in the match, the <code>groups<\/code> object will still have a property for that named group but the property will have a value of <code>undefined<\/code>:<\/p>\n<pre><code>const re = \/d+(?<ordinal>st|nd|rd|th)?\/;\n\nlet match = re.exec('2nd');\n\nconsole.log('ordinal' in match.groups);    \/\/ ? true\nconsole.log(match.groups.ordinal);         \/\/ ? nd\n\nmatch = re.exec('2');\n\nconsole.log('ordinal' in match.groups);    \/\/ ? true\nconsole.log(match.groups.ordinal);         \/\/ ? undefined\n<\/code><\/pre>\n<p>You can refer to a regular captured group later in the pattern with a backreference in the form of <code>1<\/code>. For example, the following code uses a capture group that matches two letters in a row, then recalls it later in the pattern:<\/p>\n<pre><code>console.log(\/(ww)1\/.test('abab'));    \/\/ ? true\n\n\/\/ if the last two letters are not the same \n\/\/ as the first two, the match will fail\nconsole.log(\/(ww)1\/.test('abcd'));    \/\/ ? false\n<\/code><\/pre>\n<p>To recall a named capture group later in the pattern, you can use the <code>\/k<name>\/<\/code> syntax. Here is an example:<\/p>\n<pre><code>const re = \/b(?<dup>w+)s+k<dup>b\/;\n\nconst match = re.exec(\"I'm not lazy, I'm on on energy saving mode\");        \n\nconsole.log(match.index);    \/\/ ? 18\nconsole.log(match[0]);       \/\/ ? on on\n<\/code><\/pre>\n<p>This regular expression finds consecutive duplicate words in a sentence. If you prefer, you can also recall a named capture group using a numbered back reference:<\/p>\n<pre><code>const re = \/b(?<dup>w+)s+1b\/;\n\nconst match = re.exec(\"I'm not lazy, I'm on on energy saving mode\");        \n\nconsole.log(match.index);    \/\/ ? 18\nconsole.log(match[0]);       \/\/ ? on on \n<\/code><\/pre>\n<p>It\u2019s also possible to use a numbered back reference and a named backreference at the same time:<\/p>\n<pre><code>const re = \/(?<digit>d):1:k<digit>\/;\n\nconst match = re.exec('5:5:5');        \n\nconsole.log(match[0]);    \/\/ ? 5:5:5\n<\/code><\/pre>\n<p>Similar to numbered capture groups, named capture groups can be inserted into the replacement value of the <code>replace()<\/code> method. To do that, you will need to use the <code>$<name><\/code> construct. For example:<\/p>\n<pre><code>const str = 'War & Peace';\n\nconsole.log(str.replace(\/(War) & (Peace)\/, '$2 & $1'));    \n\/\/ ? Peace & War\n\nconsole.log(str.replace(\/(?<War>War) & (?<Peace>Peace)\/, '$<Peace> & $<War>'));    \n\/\/ ? Peace & War\n<\/code><\/pre>\n<p>If you want to use a function to perform the replacement, you can reference the named groups the same way you would reference numbered groups. The value of the first capture group will be available as the second argument to the function, and the value of the second capture group will be available as the third argument:<\/p>\n<div>\n<pre><code>const str = 'War & Peace';\n\nconst result = str.replace(\/(?<War>War) & (?<Peace>Peace)\/, function(match, group1, group2, offset, string) {\n    return group2 + ' & ' + group1;\n});\n\nconsole.log(result);    \/\/ ? Peace & War\n<\/code><\/pre>\n<\/div>\n<div><\/div>\n<h3><code>s<\/code> (<code>dotAll<\/code>) Flag<\/h3>\n<p>By default, the dot (<code>.<\/code>) metacharacter in a regex pattern matches any character with the exception of line break characters, including line feed (<code>n<\/code>) and carriage return (<code>r<\/code>):<\/p>\n<pre><code>console.log(\/.\/.test('n'));    \/\/ ? false\nconsole.log(\/.\/.test('r'));    \/\/ ? false\n<\/code><\/pre>\n<p>Despite this shortcoming, JavaScript developers could still match all characters by using two opposite shorthand character classes like <code>[wW]<\/code>, which instructs the regex engine to match a character that\u2019s a word character (<code>w<\/code>) or a non-word character (<code>W<\/code>):<\/p>\n<pre><code>console.log(\/[wW]\/.test('n'));    \/\/ ? true\nconsole.log(\/[wW]\/.test('r'));    \/\/ ? true\n<\/code><\/pre>\n<p>ES2018 aims to fix this problem by introducing the <code>s<\/code> (<code>dotAll<\/code>) flag. When this flag is set, it changes the behavior of the dot (<code>.<\/code>) metacharacter to match line break characters as well:<\/p>\n<pre><code>console.log(\/.\/s.test('n'));    \/\/ ? true\nconsole.log(\/.\/s.test('r'));    \/\/ ? true\n<\/code><\/pre>\n<p>The <code>s<\/code> flag can be used on per-regex basis and thus does not break existing patterns that rely on the old behavior of the dot metacharacter. Besides JavaScript, the <code>s<\/code> flag is available in a number of other languages such as Perl and PHP.<\/p>\n<p><strong>Recommended reading<\/strong>: <em><a href=\"https:\/\/www.smashingmagazine.com\/2017\/05\/abridged-cartoon-introduction-webassembly\/\">An Abridged Cartoon Introduction To WebAssembly<\/a><\/em><\/p>\n<h3>Unicode Property Escapes<\/h3>\n<p>Among the new features introduced in ES2015 was Unicode awareness. However, shorthand character classes were still unable to match Unicode characters, even if the <code>u<\/code> flag was set.<\/p>\n<p>Consider the following example:<\/p>\n<pre><code>const str = '?';\n\nconsole.log(\/d\/.test(str));     \/\/ ? false\nconsole.log(\/d\/u.test(str));    \/\/ ? false\n<\/code><\/pre>\n<p><code>?<\/code> is considered a digit, but <code>d<\/code> can only match ASCII [0-9], so the <code>test()<\/code> method returns <code>false<\/code>. Because changing the behavior of shorthand character classes would break existing regular expression patterns, it was decided to introduce a new type of escape sequence.<\/p>\n<p>In ES2018, Unicode property escapes, denoted by <code>p{...}<\/code>, are available in regular expressions when the <code>u<\/code> flag is set. Now to match any Unicode number, you can simply use <code>p{Number}<\/code>, as shown below:<\/p>\n<pre><code>const str = '?';\nconsole.log(\/p{Number}\/u.test(str));     \/\/ ? true\n<\/code><\/pre>\n<p>And to match any Unicode alphabetic character, you can use <code>p{Alphabetic}<\/code>:<\/p>\n<pre><code>const str = '?';\n\nconsole.log(\/p{Alphabetic}\/u.test(str));     \/\/ ? true\n\n\/\/ the w shorthand cannot match ?\nconsole.log(\/w\/u.test(str));    \/\/ ? false\n<\/code><\/pre>\n<p><code>P{...}<\/code> is the negated version of <code>p{...}<\/code> and matches any character that <code>p{...}<\/code> does not:<\/p>\n<pre><code>console.log(\/P{Number}\/u.test('?'));    \/\/ ? false\nconsole.log(\/P{Number}\/u.test('?'));    \/\/ ? true\n\nconsole.log(\/P{Alphabetic}\/u.test('?'));    \/\/ ? true\nconsole.log(\/P{Alphabetic}\/u.test('?'));    \/\/ ? false\n<\/code><\/pre>\n<p><em>A full list of supported properties is available on the <a href=\"https:\/\/tc39.github.io\/proposal-regexp-unicode-property-escapes\/#sec-static-semantics-unicodematchproperty-p\">current specification proposal<\/a>.<\/em><\/p>\n<p>Note that using an unsupported property causes a <code>SyntaxError<\/code>:<\/p>\n<pre><code>console.log(\/p{undefined}\/u.test('?'));    \/\/ ? SyntaxError\n<\/code><\/pre>\n<h3>Compatibility Table<\/h3>\n<h4>Desktop Browsers<\/h4>\n<table data-tablesaw-mode=\"swipe\" data-tablesaw-minimap>\n<thead>\n<tr>\n<th data-tablesaw-priority=\"persist\"><\/th>\n<th>Chrome<\/th>\n<th>Firefox<\/th>\n<th>Safari<\/th>\n<th>Edge<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Lookbehind Assertions<\/td>\n<td>62<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<\/tr>\n<tr>\n<td>Named Capture Groups<\/td>\n<td>64<\/td>\n<td>X<\/td>\n<td>11.1<\/td>\n<td>X<\/td>\n<\/tr>\n<tr>\n<td><code>s<\/code> (<code>dotAll<\/code>) Flag<\/td>\n<td>62<\/td>\n<td>X<\/td>\n<td>11.1<\/td>\n<td>X<\/td>\n<\/tr>\n<tr>\n<td>Unicode Property Escapes<\/td>\n<td>64<\/td>\n<td>X<\/td>\n<td>11.1<\/td>\n<td>X<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Mobile Browsers<\/h4>\n<table data-tablesaw-mode=\"swipe\" data-tablesaw-minimap>\n<thead>\n<tr>\n<th data-tablesaw-priority=\"persist\"><\/th>\n<th>ChromeFor Android<\/th>\n<th>FirefoxFor Android<\/th>\n<th>iOS Safari<\/th>\n<th>Edge Mobile<\/th>\n<th>Samsung Internet<\/th>\n<th>Android Webview<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Lookbehind Assertions<\/td>\n<td>62<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<td>8.2<\/td>\n<td>62<\/td>\n<\/tr>\n<tr>\n<td>Named Capture Groups<\/td>\n<td>64<\/td>\n<td>X<\/td>\n<td>11.3<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<td>64<\/td>\n<\/tr>\n<tr>\n<td><code>s<\/code> (<code>dotAll<\/code>) Flag<\/td>\n<td>62<\/td>\n<td>X<\/td>\n<td>11.3<\/td>\n<td>X<\/td>\n<td>8.2<\/td>\n<td>62<\/td>\n<\/tr>\n<tr>\n<td>Unicode Property Escapes<\/td>\n<td>64<\/td>\n<td>X<\/td>\n<td>11.3<\/td>\n<td>X<\/td>\n<td>X<\/td>\n<td>64<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Node.js<\/h4>\n<ul>\n<li><strong>8.3.0<\/strong> (requires <code>--harmony<\/code> runtime flag)<\/li>\n<li><strong>8.10.0<\/strong> (support for <code>s<\/code> (<code>dotAll<\/code>) flag and lookbehind assertions)<\/li>\n<li><strong>10.0.0<\/strong> (full support)<\/li>\n<\/ul>\n<h3>Wrapping Up<\/h3>\n<p>ES2018 continues the work of previous editions of ECMAScript by making regular expressions more useful. New features include lookbehind assertion, named capture groups, <code>s<\/code> (<code>dotAll<\/code>) flag, and Unicode property escapes. Lookbehind assertion allows you to match a pattern only if it is preceded by another pattern. Named capture groups use a more expressive syntax compared to regular capture groups. The <code>s<\/code> (<code>dotAll<\/code>) flag changes the behavior of the dot (<code>.<\/code>) metacharacter to match line break characters. Finally, Unicode property escapes provide a new type of escape sequence in regular expressions.<\/p>\n<p>When building complicated patterns, it\u2019s often helpful to use a regular-expressions tester. A good tester provides an interface to test a regular expression against a string and displays every step taken by the engine, which can be especially useful when trying to understand patterns written by others. It can also detect syntax errors that may occur within your regex pattern. Regex101 and RegexBuddy are two popular regex testers worth checking out.<\/p>\n<p>Do you have some other tools to recommend? Share them in the comments!<\/p>\n<div>\n  <img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/02\/logo-red-5.png?w=900\" alt=\"Smashing Editorial\"><span>(dm, il)<\/span>\n<\/div>\n<\/article>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>New JavaScript Features That Will Change How You Write Regex New JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00 There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often&#8230;<a class=\"moretag\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/\"> Read the full article&#8230;<\/a><\/p>\n","protected":false},"author":4,"featured_media":60045,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[371],"tags":[],"class_list":["post-60044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-user-experience"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Guest Contribution\"\/>\n\t<meta name=\"keywords\" content=\"user experience\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies\" \/>\n\t\t<meta property=\"og:description\" content=\"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-02-09T11:19:10+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-02-09T11:19:10+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies\" \/>\n\t\t<meta name=\"twitter:description\" content=\"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#article\",\"name\":\"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies\",\"headline\":\"New JavaScript Features That Will Change How You Write Regex\",\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/form-design-patterns-shop-image.png?fit=481%2C698&ssl=1\",\"width\":481,\"height\":698},\"datePublished\":\"2019-02-09T04:19:10-07:00\",\"dateModified\":\"2019-02-09T04:19:10-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#webpage\"},\"articleSection\":\"User Experience\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"position\":2,\"name\":\"User Experience\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#listItem\",\"name\":\"New JavaScript Features That Will Change How You Write Regex\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#listItem\",\"position\":3,\"name\":\"New JavaScript Features That Will Change How You Write Regex\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/\",\"name\":\"Guest Contribution\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Guest Contribution\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#webpage\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/\",\"name\":\"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies\",\"description\":\"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/form-design-patterns-shop-image.png?fit=481%2C698&ssl=1\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#mainImage\",\"width\":481,\"height\":698},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/02\\\/new-javascript-features-that-will-change-how-you-write-regex\\\/#mainImage\"},\"datePublished\":\"2019-02-09T04:19:10-07:00\",\"dateModified\":\"2019-02-09T04:19:10-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies","description":"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished","canonical_url":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/","robots":"max-image-preview:large","keywords":"user experience","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#article","name":"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies","headline":"New JavaScript Features That Will Change How You Write Regex","author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/02\/form-design-patterns-shop-image.png?fit=481%2C698&ssl=1","width":481,"height":698},"datePublished":"2019-02-09T04:19:10-07:00","dateModified":"2019-02-09T04:19:10-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#webpage"},"isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#webpage"},"articleSection":"User Experience"},{"@type":"BreadcrumbList","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.taterboy.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","position":2,"name":"User Experience","item":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#listItem","name":"New JavaScript Features That Will Change How You Write Regex"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#listItem","position":3,"name":"New JavaScript Features That Will Change How You Write Regex","previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}}]},{"@type":"Organization","@id":"https:\/\/www.taterboy.com\/blog\/#organization","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","url":"https:\/\/www.taterboy.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author","url":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/","name":"Guest Contribution","image":{"@type":"ImageObject","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g","width":96,"height":96,"caption":"Guest Contribution"}},{"@type":"WebPage","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#webpage","url":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/","name":"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies","description":"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#breadcrumblist"},"author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"creator":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/02\/form-design-patterns-shop-image.png?fit=481%2C698&ssl=1","@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#mainImage","width":481,"height":698},"primaryImageOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/#mainImage"},"datePublished":"2019-02-09T04:19:10-07:00","dateModified":"2019-02-09T04:19:10-07:00"},{"@type":"WebSite","@id":"https:\/\/www.taterboy.com\/blog\/#website","url":"https:\/\/www.taterboy.com\/blog\/","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","og:type":"article","og:title":"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies","og:description":"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished","og:url":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/","article:published_time":"2019-02-09T11:19:10+00:00","article:modified_time":"2019-02-09T11:19:10+00:00","twitter:card":"summary","twitter:title":"New JavaScript Features That Will Change How You Write Regex | Design for Immersive Technologies","twitter:description":"New JavaScript Features That Will Change How You Write RegexNew JavaScript Features That Will Change How You Write Regex Faraz Kelhini 2019-02-08T13:00:32+01:002019-02-09T11:04:59+00:00There\u2019s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. Text processing tasks that require dozens of lines of code can often be accomplished"},"aioseo_meta_data":{"post_id":"60044","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_custom_image_width":null,"og_custom_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"created":"2021-02-07 22:35:24","updated":"2026-09-01 04:10:07","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"twitter_image_url":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/\" title=\"User Experience\">User Experience<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tNew JavaScript Features That Will Change How You Write Regex\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.taterboy.com\/blog"},{"label":"User Experience","link":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/"},{"label":"New JavaScript Features That Will Change How You Write Regex","link":"https:\/\/www.taterboy.com\/blog\/2019\/02\/new-javascript-features-that-will-change-how-you-write-regex\/"}],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8wzr5-fCs","jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/02\/form-design-patterns-shop-image.png?fit=481%2C698&ssl=1","_links":{"self":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/60044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/comments?post=60044"}],"version-history":[{"count":0,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/60044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media\/60045"}],"wp:attachment":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media?parent=60044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/categories?post=60044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/tags?post=60044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}