You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type: "paragraph"
summary: "Programming languages all have built-in data structures, but these often differ from one language to another. This article attempts to list the built-in data structures available in JavaScript and what properties they have. These can be used to build other data structures. Wherever possible, comparisons with other languages are drawn."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "If "
type: "inlineCode"
value: "true"
type: "text"
value: ", the property will be enumerated in "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Statements/for...in"
children:
type: "text"
value: "for...in"
type: "text"
value: " loops."
type: "break"
type: "text"
value: "See also "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties"
children:
type: "text"
value: "Enumerability and ownership of properties"
type: "text"
value: "."
tr (203:3) => tableRow
type: "html"
value: "<td><p>If <code>true</code>, the property will be enumerated in <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...in\">for...in</a> loops.<br>See also <a href=\"/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties\">Enumerability and ownership of properties</a>.</p></td>"
table.standard-table (180:1) => table
type: "html"
value: "<tr><td>[[Enumerable]]</td><td>Boolean</td><td><p>If <code>true</code>, the property will be enumerated in <a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...in\">for...in</a> loops.<br>See also <a href=\"/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties\">Enumerability and ownership of properties</a>.</p></td><td><code>false</code></td></tr>"
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable"
children:
type: "inlineCode"
value: "propertyIsEnumerable",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty"
children:
type: "inlineCode"
value: "hasOwnProperty"
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 2
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty"
children:
type: "inlineCode"
value: "hasOwnProperty"
type: "text"
value: " – filtered to exclude enumerables using "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable"
children:
type: "inlineCode"
value: "propertyIsEnumerable"
tr (42:5) => tableRow
type: "html"
value: "<th>Nonenumerable</th>",type: "html"
value: "<td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\">hasOwnProperty</a></code> – filtered to exclude enumerables using <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable\">propertyIsEnumerable</a></code></p></td>"
td (56:7) => tableCell
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty"
children:
type: "inlineCode"
value: "hasOwnProperty"
tr (52:5) => tableRow
type: "html"
value: "<th>Enumerable and Nonenumerable</th>",type: "html"
value: "<td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\">hasOwnProperty</a></code></p></td>"
table (21:1) => table
type: "html"
value: "<tr><th>Enumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable\">propertyIsEnumerable</a></code></p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\">hasOwnProperty</a></code></p></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Nonenumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\">hasOwnProperty</a></code> – filtered to exclude enumerables using <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable\">propertyIsEnumerable</a></code></p></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Enumerable and Nonenumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty\">hasOwnProperty</a></code></p></td><td><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Operators/in\">in</a></code></td><td>Not available without extra code</td></tr>"
td (81:7) => tableCell
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys"
children:
type: "inlineCode"
value: "Object.keys",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames"
children:
type: "inlineCode"
value: "getOwnPropertyNames"
type: "text"
value: " ",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols"
children:
type: "inlineCode"
value: "getOwnPropertySymbols"
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames"
children:
type: "inlineCode"
value: "getOwnPropertyNames",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols"
children:
type: "inlineCode"
value: "getOwnPropertySymbols"
type: "html"
value: "<tr><th>Enumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\">Object.keys</a></code></p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code> </p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code></p></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Nonenumerable</th><td><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code>, <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code> – filtered to exclude enumerables using <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable\">propertyIsEnumerable</a></code></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Enumerable and Nonenumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code></p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code></p></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>"
td (127:7) => tableCell
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys"
children:
type: "inlineCode"
value: "Object.keys",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames"
children:
type: "inlineCode"
value: "getOwnPropertyNames"
type: "text"
value: " ",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols"
children:
type: "inlineCode"
value: "getOwnPropertySymbols"
td (132:7) => tableCell
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Statements/for...in"
children:
type: "inlineCode"
value: "for..in",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "(excluding symbols)"
type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames"
children:
type: "inlineCode"
value: "getOwnPropertyNames",type: "paragraph"
summary: "Enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer. Properties defined via Object.defineProperty and such default enumerable to false."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols"
children:
type: "inlineCode"
value: "getOwnPropertySymbols"
type: "html"
value: "<tr><th>Enumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\">Object.keys</a></code></p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code> </p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code></p></td><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Statements/for...in\">for..in</a></code></p><p>(excluding symbols)</p></td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Nonenumerable</th><td><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code>, <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code> – filtered to exclude enumerables using <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable\">propertyIsEnumerable</a></code></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>",type: "html"
value: "<tr><th>Enumerable and Nonenumerable</th><td><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames\">getOwnPropertyNames</a></code></p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols\">getOwnPropertySymbols</a></code></p></td><td>Not available without extra code</td><td>Not available without extra code</td></tr>"
type: "html"
value: "<th scope=\"row\">Extension of properties</th>"
table.standard-table (57:1) => table
type: "html"
value: "<tr><th scope=\"row\">Category</th><th scope=\"col\">Class-based (Java)</th><th scope=\"col\">Prototype-based (JavaScript)</th></tr>",type: "html"
value: "<tr><th scope=\"row\">Class vs. Instance</th><td>Class and instance are distinct entities.</td><td>All objects can inherit from another object.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Definition</th><td>Define a class with a class definition; instantiate a class with constructor methods.</td><td>Define and create a set of objects with constructor functions.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Creation of new object</th><td>Create a single object with the <code>new</code> operator.</td><td>Same.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Construction of object hierarchy</th><td>Construct an object hierarchy by using class definitions to define subclasses of existing classes.</td><td>Construct an object hierarchy by assigning an object as the prototype associated with a constructor function.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Inheritance model</th><td>Inherit properties by following the class chain.</td><td>Inherit properties by following the prototype chain.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Extension of properties</th><td>Class definition specifies <em>all</em> properties of all instances of a class. Cannot add properties dynamically at run time.</td><td>Constructor function or prototype specifies an <em>initial set</em> of properties. Can add or remove properties dynamically to individual objects or to the entire set of objects.</td></tr>"
type: "paragraph"
summary: "This chapter discusses JavaScript's basic grammar, variable declarations, data types and literals."
rowIndex: 12
shouldWrap: true
children:
type: "text"
value: "The character with the Latin-1 encoding specified by the two hexadecimal digits "
type: "emphasis"
children:
type: "text"
value: "XX"
type: "text"
value: " between "
type: "inlineCode"
value: "00"
type: "text"
value: " and "
type: "inlineCode"
value: "FF"
type: "text"
value: "."
type: "break"
type: "text"
value: "For example, "
type: "inlineCode"
value: "\\xA9"
type: "text"
value: " is the hexadecimal sequence for the copyright symbol."
tr (687:3) => tableRow
type: "html"
value: "<td><p>The character with the Latin-1 encoding specified by the two hexadecimal digits <em>XX</em> between <code>00</code> and <code>FF</code>.<br>For example, <code>\\xA9</code> is the hexadecimal sequence for the copyright symbol.</p></td>"
table.standard-table (633:1) => table
type: "html"
value: "<tr><td><code>\\x<em>XX</em></code></td><td><p>The character with the Latin-1 encoding specified by the two hexadecimal digits <em>XX</em> between <code>00</code> and <code>FF</code>.<br>For example, <code>\\xA9</code> is the hexadecimal sequence for the copyright symbol.</p></td></tr>"
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "getPrototypeOf"
type: "text"
value: " method must return an object or "
type: "inlineCode"
value: "null"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "If "
type: "inlineCode"
value: "target"
type: "text"
value: " is not extensible, "
type: "inlineCode"
value: "Object.getPrototypeOf(proxy)"
type: "text"
value: " method must return the same value as "
type: "inlineCode"
value: "Object.getPrototypeOf(target)"
type: "text"
value: "."
tr (66:3) => tableRow
type: "html"
value: "<td><ul><li><code>getPrototypeOf</code> method must return an object or <code>null</code>.</li><li>If <code><var>target</var></code> is not extensible, <code>Object.getPrototypeOf(<var>proxy</var>)</code> method must return the same value as <code>Object.getPrototypeOf(<var>target</var>)</code>.</li></ul></td>"
td (102:4) => tableCell
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "getOwnPropertyDescriptor"
type: "text"
value: " must return an object or "
type: "inlineCode"
value: "undefined"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as non-existent if it exists as a non-configurable own property of "
type: "inlineCode"
value: "target"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as non-existent if it exists as an own property of "
type: "inlineCode"
value: "target"
type: "text"
value: " and "
type: "inlineCode"
value: "target"
type: "text"
value: " is not extensible."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as existent if it does not exists as an own property of "
type: "inlineCode"
value: "target"
type: "text"
value: " and "
type: "inlineCode"
value: "target"
type: "text"
value: " is not extensible."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as non-configurable if it does not exist as an own property of "
type: "inlineCode"
value: "target"
type: "text"
value: " or if it exists as a configurable own property of "
type: "inlineCode"
value: "target"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The result of "
type: "inlineCode"
value: "Object.getOwnPropertyDescriptor(target)"
type: "text"
value: " can be applied to "
type: "inlineCode"
value: "target"
type: "text"
value: " using "
type: "inlineCode"
value: "Object.defineProperty"
type: "text"
value: " and will not throw an exception."
tr (98:3) => tableRow
type: "html"
value: "<td><ul><li><code>getOwnPropertyDescriptor</code> must return an object or <code>undefined</code>.</li><li>A property cannot be reported as non-existent if it exists as a non-configurable own property of <code><var>target</var></code>.</li><li>A property cannot be reported as non-existent if it exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li><li>A property cannot be reported as existent if it does not exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li><li>A property cannot be reported as non-configurable if it does not exist as an own property of <code><var>target</var></code> or if it exists as a configurable own property of <code><var>target</var></code>.</li><li>The result of <code>Object.getOwnPropertyDescriptor(<var>target</var>)</code> can be applied to <code><var>target</var></code> using <code>Object.defineProperty</code> and will not throw an exception.</li></ul></td>"
td (117:4) => tableCell
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be added if "
type: "inlineCode"
value: "target"
type: "text"
value: " is not extensible."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of "
type: "inlineCode"
value: "target"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property may not be non-configurable if a corresponding configurable property of "
type: "inlineCode"
value: "target"
type: "text"
value: " exists."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "If a property has a corresponding target object property, then "
type: "inlineCode"
value: "Object.defineProperty(target, prop, descriptor)"
type: "text"
value: " will not throw an exception."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "In strict mode, a "
type: "inlineCode"
value: "false"
type: "text"
value: " value returned from the "
type: "inlineCode"
value: "defineProperty"
type: "text"
value: " handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception."
tr (113:3) => tableRow
type: "html"
value: "<td><ul><li>A property cannot be added if <code><var>target</var></code> is not extensible.</li><li>A property cannot be added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of <code><var>target</var></code>.</li><li>A property may not be non-configurable if a corresponding configurable property of <code><var>target</var></code> exists.</li><li>If a property has a corresponding target object property, then <code>Object.defineProperty(<var>target</var>, <var>prop</var>, <var>descriptor</var>)</code> will not throw an exception.</li><li>In strict mode, a <code>false</code> value returned from the <code>defineProperty</code> handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception.</li></ul></td>"
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as non-existent, if it exists as a non-configurable own property of "
type: "inlineCode"
value: "target"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "A property cannot be reported as non-existent if it exists as an own property of "
type: "inlineCode"
value: "target"
type: "text"
value: " and "
type: "inlineCode"
value: "target"
type: "text"
value: " is not extensible."
tr (127:3) => tableRow
type: "html"
value: "<td><dl><dt>Property query</dt><dd><code>foo in proxy</code></dd><dt>Inherited property query</dt><dd><code>foo in Object.create(<var>proxy</var>)</code><br>{{anN4cmVmKCJSZWZsZWN0LmhhcygpIik=}}</dd></dl></td>",type: "html"
value: "<td><ul><li>A property cannot be reported as non-existent, if it exists as a non-configurable own property of <code><var>target</var></code>.</li><li>A property cannot be reported as non-existent if it exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li></ul></td>"
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The value reported for a property must be the same as the value of the corresponding "
type: "inlineCode"
value: "target"
type: "text"
value: " property if "
type: "inlineCode"
value: "target"
type: "text"
value: "'s property is a non-writable, non-configurable data property."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The value reported for a property must be "
type: "inlineCode"
value: "undefined"
type: "text"
value: " if the corresponding "
type: "inlineCode"
value: "target"
type: "text"
value: " property is non-configurable accessor property that has undefined as its "
type: "inlineCode"
value: "[[Get]]"
type: "text"
value: " attribute."
tr (145:3) => tableRow
type: "html"
value: "<td><dl><dt>Property access</dt><dd><code><var>proxy</var>[foo]</code><br><code><var>proxy</var>.bar</code></dd><dt>Inherited property access</dt><dd><code>Object.create(<var>proxy</var>)[foo]</code><br>{{anN4cmVmKCJSZWZsZWN0LmdldCgpIik=}}</dd></dl></td>",type: "html"
value: "<td><ul><li>The value reported for a property must be the same as the value of the corresponding <code><var>target</var></code> property if <code><var>target</var></code>'s property is a non-writable, non-configurable data property.</li><li>The value reported for a property must be <code>undefined</code> if the corresponding <code><var>target</var></code> property is non-configurable accessor property that has undefined as its <code>[[Get]]</code> attribute.</li></ul></td>"
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Cannot change the value of a property to be different from the value of the corresponding "
type: "inlineCode"
value: "target"
type: "text"
value: " property if the corresponding "
type: "inlineCode"
value: "target"
type: "text"
value: " property is a non-writable, non-configurable data property."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Cannot set the value of a property if the corresponding "
type: "inlineCode"
value: "target"
type: "text"
value: " property is a non-configurable accessor property that has "
type: "inlineCode"
value: "undefined"
type: "text"
value: " as its "
type: "inlineCode"
value: "[[Set]]"
type: "text"
value: " attribute."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "In strict mode, a "
type: "inlineCode"
value: "false"
type: "text"
value: " return value from the "
type: "inlineCode"
value: "set"
type: "text"
value: " handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception."
tr (164:3) => tableRow
type: "html"
value: "<td><dl><dt>Property assignment</dt><dd><code><var>proxy</var>[foo] = bar</code><br><code><var>proxy</var>.foo = bar</code></dd><dt>Inherited property assignment</dt><dd><code>Object.create(<var>proxy</var>)[foo] = bar</code><br>{{anN4cmVmKCJSZWZsZWN0LnNldCgpIik=}}</dd></dl></td>",type: "html"
value: "<td><ul><li>Cannot change the value of a property to be different from the value of the corresponding <code><var>target</var></code> property if the corresponding <code><var>target</var></code> property is a non-writable, non-configurable data property.</li><li>Cannot set the value of a property if the corresponding <code><var>target</var></code> property is a non-configurable accessor property that has <code>undefined</code> as its <code>[[Set]]</code> attribute.</li><li>In strict mode, a <code>false</code> return value from the <code>set</code> handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception.</li></ul></td>"
type: "html"
value: "<td><dl><dt>Property enumeration / <code>for...in</code>:</dt><dd><code>for (let name in <var>proxy</var>) {...}</code><br>{{anN4cmVmKCJSZWZsZWN0LmVudW1lcmF0ZSgpIik=}}</dd></dl></td>"
td (213:4) => tableCell
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The result of "
type: "inlineCode"
value: "ownKeys"
type: "text"
value: " is a List."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The Type of each result List element is either {{anN4cmVmKCJTdHJpbmciKQ==}} or {{anN4cmVmKCJTeW1ib2wiKQ==}}."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "The result List must contain the keys of all non-configurable own properties of "
type: "inlineCode"
value: "target"
type: "text"
value: "."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "If the "
type: "inlineCode"
value: "target"
type: "text"
value: " object is not extensible, then the result List must contain all the keys of the own properties of "
type: "inlineCode"
value: "target"
type: "text"
value: " and no other values."
tr (207:3) => tableRow
type: "html"
value: "<td><ul><li>The result of <code>ownKeys</code> is a List.</li><li>The Type of each result List element is either {{anN4cmVmKCJTdHJpbmciKQ==}} or {{anN4cmVmKCJTeW1ib2wiKQ==}}.</li><li>The result List must contain the keys of all non-configurable own properties of <code><var>target</var></code>.</li><li>If the <code><var>target</var></code> object is not extensible, then the result List must contain all the keys of the own properties of <code><var>target</var></code> and no other values.</li></ul></td>"
table.standard-table (57:1) => table
type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9nZXRQcm90b3R5cGVPZiIsICJoYW5kbGVyLmdldFByb3RvdHlwZU9mKCkiKQ==}}</td><td>{{anN4cmVmKCJPYmplY3QuZ2V0UHJvdG90eXBlT2YoKSIp}}<br>{{anN4cmVmKCJSZWZsZWN0LmdldFByb3RvdHlwZU9mKCkiKQ==}}<br>{{anN4cmVmKCJPYmplY3QvcHJvdG8iLCAiX19wcm90b19fIik=}}<br>{{anN4cmVmKCJPYmplY3QucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoKSIp}}<br>{{anN4cmVmKCJPcGVyYXRvcnMvaW5zdGFuY2VvZiIsICJpbnN0YW5jZW9mIik=}}</td><td><ul><li><code>getPrototypeOf</code> method must return an object or <code>null</code>.</li><li>If <code><var>target</var></code> is not extensible, <code>Object.getPrototypeOf(<var>proxy</var>)</code> method must return the same value as <code>Object.getPrototypeOf(<var>target</var>)</code>.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCAiaGFuZGxlci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoKSIp}}</td><td>{{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKCkiKQ==}}<br>{{anN4cmVmKCJSZWZsZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcigpIik=}}</td><td><ul><li><code>getOwnPropertyDescriptor</code> must return an object or <code>undefined</code>.</li><li>A property cannot be reported as non-existent if it exists as a non-configurable own property of <code><var>target</var></code>.</li><li>A property cannot be reported as non-existent if it exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li><li>A property cannot be reported as existent if it does not exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li><li>A property cannot be reported as non-configurable if it does not exist as an own property of <code><var>target</var></code> or if it exists as a configurable own property of <code><var>target</var></code>.</li><li>The result of <code>Object.getOwnPropertyDescriptor(<var>target</var>)</code> can be applied to <code><var>target</var></code> using <code>Object.defineProperty</code> and will not throw an exception.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9kZWZpbmVQcm9wZXJ0eSIsICJoYW5kbGVyLmRlZmluZVByb3BlcnR5KCkiKQ==}}</td><td>{{anN4cmVmKCJPYmplY3QuZGVmaW5lUHJvcGVydHkoKSIp}}<br>{{anN4cmVmKCJSZWZsZWN0LmRlZmluZVByb3BlcnR5KCkiKQ==}}</td><td><ul><li>A property cannot be added if <code><var>target</var></code> is not extensible.</li><li>A property cannot be added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of <code><var>target</var></code>.</li><li>A property may not be non-configurable if a corresponding configurable property of <code><var>target</var></code> exists.</li><li>If a property has a corresponding target object property, then <code>Object.defineProperty(<var>target</var>, <var>prop</var>, <var>descriptor</var>)</code> will not throw an exception.</li><li>In strict mode, a <code>false</code> value returned from the <code>defineProperty</code> handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9oYXMiLCAiaGFuZGxlci5oYXMoKSIp}}</td><td><dl><dt>Property query</dt><dd><code>foo in proxy</code></dd><dt>Inherited property query</dt><dd><code>foo in Object.create(<var>proxy</var>)</code><br>{{anN4cmVmKCJSZWZsZWN0LmhhcygpIik=}}</dd></dl></td><td><ul><li>A property cannot be reported as non-existent, if it exists as a non-configurable own property of <code><var>target</var></code>.</li><li>A property cannot be reported as non-existent if it exists as an own property of <code><var>target</var></code> and <code><var>target</var></code> is not extensible.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9nZXQiLCAiaGFuZGxlci5nZXQoKSIp}}</td><td><dl><dt>Property access</dt><dd><code><var>proxy</var>[foo]</code><br><code><var>proxy</var>.bar</code></dd><dt>Inherited property access</dt><dd><code>Object.create(<var>proxy</var>)[foo]</code><br>{{anN4cmVmKCJSZWZsZWN0LmdldCgpIik=}}</dd></dl></td><td><ul><li>The value reported for a property must be the same as the value of the corresponding <code><var>target</var></code> property if <code><var>target</var></code>'s property is a non-writable, non-configurable data property.</li><li>The value reported for a property must be <code>undefined</code> if the corresponding <code><var>target</var></code> property is non-configurable accessor property that has undefined as its <code>[[Get]]</code> attribute.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9zZXQiLCAiaGFuZGxlci5zZXQoKSIp}}</td><td><dl><dt>Property assignment</dt><dd><code><var>proxy</var>[foo] = bar</code><br><code><var>proxy</var>.foo = bar</code></dd><dt>Inherited property assignment</dt><dd><code>Object.create(<var>proxy</var>)[foo] = bar</code><br>{{anN4cmVmKCJSZWZsZWN0LnNldCgpIik=}}</dd></dl></td><td><ul><li>Cannot change the value of a property to be different from the value of the corresponding <code><var>target</var></code> property if the corresponding <code><var>target</var></code> property is a non-writable, non-configurable data property.</li><li>Cannot set the value of a property if the corresponding <code><var>target</var></code> property is a non-configurable accessor property that has <code>undefined</code> as its <code>[[Set]]</code> attribute.</li><li>In strict mode, a <code>false</code> return value from the <code>set</code> handler will throw a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} exception.</li></ul></td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9kZWxldGVQcm9wZXJ0eSIsICJoYW5kbGVyLmRlbGV0ZVByb3BlcnR5KCkiKQ==}}</td><td><dl><dt>Property deletion</dt><dd><code>delete <var>proxy</var>[foo]</code><br><code>delete <var>proxy</var>.foo</code><br>{{anN4cmVmKCJSZWZsZWN0LmRlbGV0ZVByb3BlcnR5KCkiKQ==}}</dd></dl></td><td>A property cannot be deleted if it exists as a non-configurable own property of <code><var>target</var></code>.</td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9oYW5kbGVyL2VudW1lcmF0ZSIsICJoYW5kbGVyLmVudW1lcmF0ZSgpIik=}}</td><td><dl><dt>Property enumeration / <code>for...in</code>:</dt><dd><code>for (let name in <var>proxy</var>) {...}</code><br>{{anN4cmVmKCJSZWZsZWN0LmVudW1lcmF0ZSgpIik=}}</dd></dl></td><td>The <code>enumerate</code> method must return an object.</td></tr>",type: "html"
value: "<tr><td>{{anN4cmVmKCJHbG9iYWxfT2JqZWN0cy9Qcm94eS9Qcm94eS9vd25LZXlzIiwgImhhbmRsZXIub3duS2V5cygpIik=}}</td><td>{{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcygpIik=}}<br>{{anN4cmVmKCJPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKCkiKQ==}}<br>{{anN4cmVmKCJPYmplY3Qua2V5cygpIik=}}<br>{{anN4cmVmKCJSZWZsZWN0Lm93bktleXMoKSIp}}</td><td><ul><li>The result of <code>ownKeys</code> is a List.</li><li>The Type of each result List element is either {{anN4cmVmKCJTdHJpbmciKQ==}} or {{anN4cmVmKCJTeW1ib2wiKQ==}}.</li><li>The result List must contain the keys of all non-configurable own properties of <code><var>target</var></code>.</li><li>If the <code><var>target</var></code> object is not extensible, then the result List must contain all the keys of the own properties of <code><var>target</var></code> and no other values.</li></ul></td></tr>"
type: "paragraph"
summary: "This chapter introduces the concepts, objects and functions used to work with and perform calculations using numbers and dates in JavaScript. This includes using numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the global {{anN4cmVmKCJNYXRoIik=}} object to perform a wide variety of mathematical operations on numbers."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "{{anN4cmVmKCJNYXRoLnBvdyIsICJwb3coKSIp}}, {{anN4cmVmKCJNYXRoLmV4cCIsICJleHAoKSIp}}, {{anN4cmVmKCJNYXRoLmV4cG0xIiwgImV4cG0xKCkiKQ==}}, {{anN4cmVmKCJNYXRoLmxvZzEwIiwgImxvZzEwKCkiKQ==}}, {{anN4cmVmKCJNYXRoLmxvZzFwIiwgImxvZzFwKCkiKQ==}}, {{anN4cmVmKCJNYXRoLmxvZzIiLCAibG9nMigpIik=}}"
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, "
type: "inlineCode"
value: "/^A/"
type: "text"
value: " does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " This character has a different meaning when it appears at the start of a "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges"
children:
type: "text"
value: "group"
type: "text"
value: "."
tr (32:3) => tableRow
type: "html"
value: "<td><p>Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, <code>/^A/</code> does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".</p><div class=\"notecard note\"><p><strong>Note:</strong> This character has a different meaning when it appears at the start of a <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges\">group</a>.</p></div></td>"
td (44:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, "
type: "inlineCode"
value: "/t$/"
type: "text"
value: " does not match the \"t\" in \"eater\", but does match it in \"eat\"."
tr (42:3) => tableRow
type: "html"
value: "<td><p>Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, <code>/t$/</code> does not match the \"t\" in \"eater\", but does match it in \"eat\".</p></td>"
td (50:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.",type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Examples:",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/\\bm/"
type: "text"
value: " matches the \"m\" in \"moon\"."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/oo\\b/"
type: "text"
value: " does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/oon\\b/"
type: "text"
value: " matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/\\w\\b\\w/"
type: "text"
value: " will never match anything, because a word character can never be followed by both a non-word and a word character.",type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "To match a backspace character ("
type: "inlineCode"
value: "[\\b]"
type: "text"
value: "), see "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes"
children:
type: "text"
value: "Character Classes"
type: "text"
value: "."
tr (48:3) => tableRow
type: "html"
value: "<td><p>Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.</p><p>Examples:</p><ul><li><code>/\\bm/</code> matches the \"m\" in \"moon\".</li><li><code>/oo\\b/</code> does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character.</li><li><code>/oon\\b/</code> matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character.</li><li><code>/\\w\\b\\w/</code> will never match anything, because a word character can never be followed by both a non-word and a word character.</li></ul><p>To match a backspace character (<code>[\\b]</code>), see <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes\">Character Classes</a>.</p></td>"
td (67:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, "
type: "inlineCode"
value: "/\\Bon/"
type: "text"
value: " matches \"on\" in \"at noon\", and "
type: "inlineCode"
value: "/ye\\B/"
type: "text"
value: " matches \"ye\" in \"possibly yesterday\"."
tr (65:3) => tableRow
type: "html"
value: "<td><p>Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, <code>/\\Bon/</code> matches \"on\" in \"at noon\", and <code>/ye\\B/</code> matches \"ye\" in \"possibly yesterday\".</p></td>"
table.standard-table (24:1) => table
type: "html"
value: "<tr><td><code>^</code></td><td><p>Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, <code>/^A/</code> does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".</p><div class=\"notecard note\"><p><strong>Note:</strong> This character has a different meaning when it appears at the start of a <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges\">group</a>.</p></div></td></tr>",type: "html"
value: "<tr><td><code>$</code></td><td><p>Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, <code>/t$/</code> does not match the \"t\" in \"eater\", but does match it in \"eat\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\b</code></td><td><p>Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.</p><p>Examples:</p><ul><li><code>/\\bm/</code> matches the \"m\" in \"moon\".</li><li><code>/oo\\b/</code> does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character.</li><li><code>/oon\\b/</code> matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character.</li><li><code>/\\w\\b\\w/</code> will never match anything, because a word character can never be followed by both a non-word and a word character.</li></ul><p>To match a backspace character (<code>[\\b]</code>), see <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes\">Character Classes</a>.</p></td></tr>",type: "html"
value: "<tr><td><code>\\B</code></td><td><p>Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, <code>/\\Bon/</code> matches \"on\" in \"at noon\", and <code>/ye\\B/</code> matches \"ye\" in \"possibly yesterday\".</p></td></tr>"
td (90:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 1
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Lookahead assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is followed by \"y\". For example, /"
type: "inlineCode"
value: "Jack(?=Sprat)/"
type: "text"
value: " matches \"Jack\" only if it is followed by \"Sprat\"."
type: "break"
type: "inlineCode"
value: "/Jack(?=Sprat|Frost)/"
type: "text"
value: " matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results."
tr (88:3) => tableRow
type: "html"
value: "<td><p><strong>Lookahead assertion: </strong>Matches \"x\" only if \"x\" is followed by \"y\". For example, /<code>Jack(?=Sprat)/</code> matches \"Jack\" only if it is followed by \"Sprat\".<br><code>/Jack(?=Sprat|Frost)/</code> matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results.</p></td>"
td (97:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 2
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Negative lookahead assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is not followed by \"y\". For example, "
type: "inlineCode"
value: "/\\d+(?!\\.)/"
type: "text"
value: " matches a number only if it is not followed by a decimal point. "
type: "inlineCode"
value: "/\\d+(?!\\.)/.exec('3.141')"
type: "text"
value: " matches \"141\" but not \"3\"."
tr (95:3) => tableRow
type: "html"
value: "<td><p><strong>Negative lookahead assertion: </strong>Matches \"x\" only if \"x\" is not followed by \"y\". For example, <code>/\\d+(?!\\.)/</code> matches a number only if it is not followed by a decimal point. <code>/\\d+(?!\\.)/.exec('3.141')</code> matches \"141\" but not \"3\".</p></td>"
td (103:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 3
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Lookbehind assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is preceded by \"y\". For example, "
type: "inlineCode"
value: "/(?<=Jack)Sprat/"
type: "text"
value: " matches \"Sprat\" only if it is preceded by \"Jack\". "
type: "inlineCode"
value: "/(?<=Jack|Tom)Sprat/"
type: "text"
value: " matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results."
tr (101:3) => tableRow
type: "html"
value: "<td><p><strong>Lookbehind assertion: </strong>Matches \"x\" only if \"x\" is preceded by \"y\". For example, <code>/(?<=Jack)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\". <code>/(?<=Jack|Tom)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results.</p></td>"
td (109:4) => tableCell
type: "paragraph"
summary: "Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions)."
rowIndex: 4
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Negative lookbehind assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is not preceded by \"y\". For example, "
type: "inlineCode"
value: "/(?<!-)\\d+/"
type: "text"
value: " matches a number only if it is not preceded by a minus sign. "
type: "inlineCode"
value: "/(?<!-)\\d+/.exec('3')"
type: "text"
value: " matches \"3\". "
type: "inlineCode"
value: "/(?<!-)\\d+/.exec('-3')"
type: "text"
value: " match is not found because the number is preceded by the minus sign."
tr (107:3) => tableRow
type: "html"
value: "<td><p><strong>Negative lookbehind assertion: </strong>Matches \"x\" only if \"x\" is not preceded by \"y\". For example, <code>/(?<!-)\\d+/</code> matches a number only if it is not preceded by a minus sign. <code>/(?<!-)\\d+/.exec('3')</code> matches \"3\". <code>/(?<!-)\\d+/.exec('-3')</code> match is not found because the number is preceded by the minus sign.</p></td>"
table.standard-table (80:1) => table
type: "html"
value: "<tr><td><code>x(?=y)</code></td><td><p><strong>Lookahead assertion: </strong>Matches \"x\" only if \"x\" is followed by \"y\". For example, /<code>Jack(?=Sprat)/</code> matches \"Jack\" only if it is followed by \"Sprat\".<br><code>/Jack(?=Sprat|Frost)/</code> matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results.</p></td></tr>",type: "html"
value: "<tr><td><code>x(?!y)</code></td><td><p><strong>Negative lookahead assertion: </strong>Matches \"x\" only if \"x\" is not followed by \"y\". For example, <code>/\\d+(?!\\.)/</code> matches a number only if it is not followed by a decimal point. <code>/\\d+(?!\\.)/.exec('3.141')</code> matches \"141\" but not \"3\".</p></td></tr>",type: "html"
value: "<tr><td><code>(?<=y)x</code></td><td><p><strong>Lookbehind assertion: </strong>Matches \"x\" only if \"x\" is preceded by \"y\". For example, <code>/(?<=Jack)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\". <code>/(?<=Jack|Tom)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results.</p></td></tr>",type: "html"
value: "<tr><td><code>(?<!y)x</code></td><td><p><strong>Negative lookbehind assertion: </strong>Matches \"x\" only if \"x\" is not preceded by \"y\". For example, <code>/(?<!-)\\d+/</code> matches a number only if it is not preceded by a minus sign. <code>/(?<!-)\\d+/.exec('3')</code> matches \"3\". <code>/(?<!-)\\d+/.exec('-3')</code> match is not found because the number is preceded by the minus sign.</p></td></tr>"
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Has one of the following meanings:",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Matches any single character "
type: "emphasis"
children:
type: "text"
value: "except"
type: "text"
value: " line terminators: "
type: "inlineCode"
value: "\\n"
type: "text"
value: ", "
type: "inlineCode"
value: "\\r"
type: "text"
value: ", "
type: "inlineCode"
value: "\\u2028"
type: "text"
value: " or "
type: "inlineCode"
value: "\\u2029"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/.y/"
type: "text"
value: " matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\"."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Inside a character class, the dot loses its special meaning and matches a literal dot.",type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Note that the "
type: "inlineCode"
value: "m"
type: "text"
value: " multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class "
type: "inlineCode"
value: "[^]"
type: "text"
value: " can be used — it will match any character including newlines.",type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "ES2018 added the "
type: "inlineCode"
value: "s"
type: "text"
value: " \"dotAll\" flag, which allows the dot to also match line terminators."
tr (32:3) => tableRow
type: "html"
value: "<td><p>Has one of the following meanings:</p><ul><li>Matches any single character <em>except</em> line terminators: <code>\\n</code>, <code>\\r</code>, <code>\\u2028</code> or <code>\\u2029</code>. For example, <code>/.y/</code> matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\".</li><li>Inside a character class, the dot loses its special meaning and matches a literal dot.</li></ul><p>Note that the <code>m</code> multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class <code>[^]</code> can be used — it will match any character including newlines.</p><p>ES2018 added the <code>s</code> \"dotAll\" flag, which allows the dot to also match line terminators.</p></td>"
td (49:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches any digit (Arabic numeral). Equivalent to "
type: "inlineCode"
value: "[0-9]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\d/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[0-9]/"
type: "text"
value: " matches \"2\" in \"B2 is the suite number\"."
tr (47:3) => tableRow
type: "html"
value: "<td><p>Matches any digit (Arabic numeral). Equivalent to <code>[0-9]</code>. For example, <code>/\\d/</code> or <code>/[0-9]/</code> matches \"2\" in \"B2 is the suite number\".</p></td>"
td (55:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches any character that is not a digit (Arabic numeral). Equivalent to "
type: "inlineCode"
value: "[^0-9]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\D/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[^0-9]/"
type: "text"
value: " matches \"B\" in \"B2 is the suite number\"."
tr (53:3) => tableRow
type: "html"
value: "<td><p>Matches any character that is not a digit (Arabic numeral). Equivalent to <code>[^0-9]</code>. For example, <code>/\\D/</code> or <code>/[^0-9]/</code> matches \"B\" in \"B2 is the suite number\".</p></td>"
td (61:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to "
type: "inlineCode"
value: "[A-Za-z0-9_]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\w/"
type: "text"
value: " matches \"a\" in \"apple\", \"5\" in \"$5.28\", \"3\" in \"3D\" and \"m\" in \"Émanuel\"."
tr (59:3) => tableRow
type: "html"
value: "<td><p>Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to <code>[A-Za-z0-9_]</code>. For example, <code>/\\w/</code> matches \"a\" in \"apple\", \"5\" in \"$5.28\", \"3\" in \"3D\" and \"m\" in \"Émanuel\".</p></td>"
td (67:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Matches any character that is not a word character from the basic Latin alphabet. Equivalent to "
type: "inlineCode"
value: "[^A-Za-z0-9_]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\W/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[^A-Za-z0-9_]/"
type: "text"
value: " matches \"%\" in \"50%\" and \"É\" in \"Émanuel\"."
tr (65:3) => tableRow
type: "html"
value: "<td><p>Matches any character that is not a word character from the basic Latin alphabet. Equivalent to <code>[^A-Za-z0-9_]</code>. For example, <code>/\\W/</code> or <code>/[^A-Za-z0-9_]/</code> matches \"%\" in \"50%\" and \"É\" in \"Émanuel\".</p></td>"
td (73:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to "
type: "inlineCode"
value: "[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\s\\w*/"
type: "text"
value: " matches \" bar\" in \"foo bar\"."
tr (71:3) => tableRow
type: "html"
value: "<td><p>Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to <code>[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\s\\w*/</code> matches \" bar\" in \"foo bar\".</p></td>"
td (79:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "Matches a single character other than white space. Equivalent to "
type: "inlineCode"
value: "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\S\\w*/"
type: "text"
value: " matches \"foo\" in \"foo bar\"."
tr (77:3) => tableRow
type: "html"
value: "<td><p>Matches a single character other than white space. Equivalent to <code>[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\S\\w*/</code> matches \"foo\" in \"foo bar\".</p></td>"
td (113:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 15
shouldWrap: true
children:
type: "text"
value: "Matches a control character using "
type: "link"
title:
url: "https://en.wikipedia.org/wiki/Caret_notation"
children:
type: "text"
value: "caret notation"
type: "text"
value: ", where \"X\" is a letter from A–Z (corresponding to codepoints "
type: "inlineCode"
value: "U+0001"
type: "emphasis"
children:
type: "text"
value: "–"
type: "inlineCode"
value: "U+001A"
type: "text"
value: "). For example, "
type: "inlineCode"
value: "/\\cM\\cJ/"
type: "text"
value: " matches \"\\r\\n\"."
tr (111:3) => tableRow
type: "html"
value: "<td><p>Matches a control character using <a href=\"https://en.wikipedia.org/wiki/Caret_notation\">caret notation</a>, where \"X\" is a letter from A–Z (corresponding to codepoints <code>U+0001</code><em>–</em><code>U+001A</code>). For example, <code>/\\cM\\cJ/</code> matches \"\\r\\n\".</p></td>"
td (135:4) => tableCell
type: "paragraph"
summary: "Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits."
rowIndex: 20
shouldWrap: true
children:
type: "text"
value: "Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, "
type: "inlineCode"
value: "/b/"
type: "text"
value: " matches the character \"b\". By placing a backslash in front of \"b\", that is by using "
type: "inlineCode"
value: "/\\b/"
type: "text"
value: ", the character becomes special to mean match a word boundary."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, "
type: "inlineCode"
value: "/a*/"
type: "text"
value: " means match 0 or more \"a\"s. To match "
type: "inlineCode"
value: "*"
type: "text"
value: " literally, precede it with a backslash; for example, "
type: "inlineCode"
value: "/a\\*/"
type: "text"
value: " matches \"a*\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " To match this character literally, escape it with itself. In other words to search for "
type: "inlineCode"
value: "\\"
type: "text"
value: " use "
type: "inlineCode"
value: "/\\\\/"
type: "text"
value: "."
tr (133:3) => tableRow
type: "html"
value: "<td><p>Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.</p><ul><li>For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, <code>/b/</code> matches the character \"b\". By placing a backslash in front of \"b\", that is by using <code>/\\b/</code>, the character becomes special to mean match a word boundary.</li><li>For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, <code>/a*/</code> means match 0 or more \"a\"s. To match <code>*</code> literally, precede it with a backslash; for example, <code>/a\\*/</code> matches \"a*\".</li></ul><div class=\"notecard note\"><p><strong>Note:</strong> To match this character literally, escape it with itself. In other words to search for <code>\\</code> use <code>/\\\\/</code>.</p></div></td>"
table.standard-table (22:1) => table
type: "html"
value: "<tr><td><code>.</code></td><td><p>Has one of the following meanings:</p><ul><li>Matches any single character <em>except</em> line terminators: <code>\\n</code>, <code>\\r</code>, <code>\\u2028</code> or <code>\\u2029</code>. For example, <code>/.y/</code> matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\".</li><li>Inside a character class, the dot loses its special meaning and matches a literal dot.</li></ul><p>Note that the <code>m</code> multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class <code>[^]</code> can be used — it will match any character including newlines.</p><p>ES2018 added the <code>s</code> \"dotAll\" flag, which allows the dot to also match line terminators.</p></td></tr>",type: "html"
value: "<tr><td><code>\\d</code></td><td><p>Matches any digit (Arabic numeral). Equivalent to <code>[0-9]</code>. For example, <code>/\\d/</code> or <code>/[0-9]/</code> matches \"2\" in \"B2 is the suite number\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\D</code></td><td><p>Matches any character that is not a digit (Arabic numeral). Equivalent to <code>[^0-9]</code>. For example, <code>/\\D/</code> or <code>/[^0-9]/</code> matches \"B\" in \"B2 is the suite number\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\w</code></td><td><p>Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to <code>[A-Za-z0-9_]</code>. For example, <code>/\\w/</code> matches \"a\" in \"apple\", \"5\" in \"$5.28\", \"3\" in \"3D\" and \"m\" in \"Émanuel\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\W</code></td><td><p>Matches any character that is not a word character from the basic Latin alphabet. Equivalent to <code>[^A-Za-z0-9_]</code>. For example, <code>/\\W/</code> or <code>/[^A-Za-z0-9_]/</code> matches \"%\" in \"50%\" and \"É\" in \"Émanuel\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\s</code></td><td><p>Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to <code>[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\s\\w*/</code> matches \" bar\" in \"foo bar\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\S</code></td><td><p>Matches a single character other than white space. Equivalent to <code>[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\S\\w*/</code> matches \"foo\" in \"foo bar\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\c<em>X</em></code></td><td><p>Matches a control character using <a href=\"https://en.wikipedia.org/wiki/Caret_notation\">caret notation</a>, where \"X\" is a letter from A–Z (corresponding to codepoints <code>U+0001</code><em>–</em><code>U+001A</code>). For example, <code>/\\cM\\cJ/</code> matches \"\\r\\n\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\</code></td><td><p>Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.</p><ul><li>For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, <code>/b/</code> matches the character \"b\". By placing a backslash in front of \"b\", that is by using <code>/\\b/</code>, the character becomes special to mean match a word boundary.</li><li>For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, <code>/a*/</code> means match 0 or more \"a\"s. To match <code>*</code> literally, precede it with a backslash; for example, <code>/a\\*/</code> matches \"a*\".</li></ul><div class=\"notecard note\"><p><strong>Note:</strong> To match this character literally, escape it with itself. In other words to search for <code>\\</code> use <code>/\\\\/</code>.</p></div></td></tr>"
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Has one of the following meanings:",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Matches any single character "
type: "emphasis"
children:
type: "text"
value: "except"
type: "text"
value: " line terminators: "
type: "inlineCode"
value: "\\n"
type: "text"
value: ", "
type: "inlineCode"
value: "\\r"
type: "text"
value: ", "
type: "inlineCode"
value: "\\u2028"
type: "text"
value: " or "
type: "inlineCode"
value: "\\u2029"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/.y/"
type: "text"
value: " matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\"."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Inside a character class, the dot loses its special meaning and matches a literal dot.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Note that the "
type: "inlineCode"
value: "m"
type: "text"
value: " multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class "
type: "inlineCode"
value: "[^]"
type: "text"
value: " can be used — it will match any character including newlines.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "ES2018 added the "
type: "inlineCode"
value: "s"
type: "text"
value: " \"dotAll\" flag, which allows the dot to also match line terminators."
tr (28:3) => tableRow
type: "html"
value: "<td><p>Has one of the following meanings:</p><ul><li>Matches any single character <em>except</em> line terminators: <code>\\n</code>, <code>\\r</code>, <code>\\u2028</code> or <code>\\u2029</code>. For example, <code>/.y/</code> matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\".</li><li>Inside a character class, the dot loses its special meaning and matches a literal dot.</li></ul><p>Note that the <code>m</code> multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class <code>[^]</code> can be used — it will match any character including newlines.</p><p>ES2018 added the <code>s</code> \"dotAll\" flag, which allows the dot to also match line terminators.</p></td>"
td (45:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches any digit (Arabic numeral). Equivalent to "
type: "inlineCode"
value: "[0-9]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\d/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[0-9]/"
type: "text"
value: " matches \"2\" in \"B2 is the suite number\"."
tr (43:3) => tableRow
type: "html"
value: "<td><p>Matches any digit (Arabic numeral). Equivalent to <code>[0-9]</code>. For example, <code>/\\d/</code> or <code>/[0-9]/</code> matches \"2\" in \"B2 is the suite number\".</p></td>"
td (51:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches any character that is not a digit (Arabic numeral). Equivalent to "
type: "inlineCode"
value: "[^0-9]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\D/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[^0-9]/"
type: "text"
value: " matches \"B\" in \"B2 is the suite number\"."
tr (49:3) => tableRow
type: "html"
value: "<td><p>Matches any character that is not a digit (Arabic numeral). Equivalent to <code>[^0-9]</code>. For example, <code>/\\D/</code> or <code>/[^0-9]/</code> matches \"B\" in \"B2 is the suite number\".</p></td>"
td (57:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to "
type: "inlineCode"
value: "[A-Za-z0-9_]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\w/"
type: "text"
value: " matches \"a\" in \"apple\", \"5\" in \"$5.28\", and \"3\" in \"3D\"."
tr (55:3) => tableRow
type: "html"
value: "<td><p>Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to <code>[A-Za-z0-9_]</code>. For example, <code>/\\w/</code> matches \"a\" in \"apple\", \"5\" in \"$5.28\", and \"3\" in \"3D\".</p></td>"
td (63:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Matches any character that is not a word character from the basic Latin alphabet. Equivalent to "
type: "inlineCode"
value: "[^A-Za-z0-9_]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\W/"
type: "text"
value: " or "
type: "inlineCode"
value: "/[^A-Za-z0-9_]/"
type: "text"
value: " matches \"%\" in \"50%\"."
tr (61:3) => tableRow
type: "html"
value: "<td><p>Matches any character that is not a word character from the basic Latin alphabet. Equivalent to <code>[^A-Za-z0-9_]</code>. For example, <code>/\\W/</code> or <code>/[^A-Za-z0-9_]/</code> matches \"%\" in \"50%\".</p></td>"
td (69:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to "
type: "inlineCode"
value: "[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\s\\w*/"
type: "text"
value: " matches \" bar\" in \"foo bar\"."
tr (67:3) => tableRow
type: "html"
value: "<td><p>Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to <code>[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\s\\w*/</code> matches \" bar\" in \"foo bar\".</p></td>"
td (75:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "Matches a single character other than white space. Equivalent to "
type: "inlineCode"
value: "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/\\S\\w*/"
type: "text"
value: " matches \"foo\" in \"foo bar\"."
tr (73:3) => tableRow
type: "html"
value: "<td><p>Matches a single character other than white space. Equivalent to <code>[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\S\\w*/</code> matches \"foo\" in \"foo bar\".</p></td>"
td (109:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 15
shouldWrap: true
children:
type: "text"
value: "Matches a control character using "
type: "link"
title:
url: "https://en.wikipedia.org/wiki/Caret_notation"
children:
type: "text"
value: "caret notation"
type: "text"
value: ", where \"X\" is a letter from A–Z (corresponding to codepoints "
type: "inlineCode"
value: "U+0001"
type: "emphasis"
children:
type: "text"
value: "–"
type: "inlineCode"
value: "U+001F"
type: "text"
value: "). For example, "
type: "inlineCode"
value: "/\\cM/"
type: "text"
value: " matches \"\\r\" in \"\\r\\n\"."
tr (107:3) => tableRow
type: "html"
value: "<td><p>Matches a control character using <a href=\"https://en.wikipedia.org/wiki/Caret_notation\">caret notation</a>, where \"X\" is a letter from A–Z (corresponding to codepoints <code>U+0001</code><em>–</em><code>U+001F</code>). For example, <code>/\\cM/</code> matches \"\\r\" in \"\\r\\n\".</p></td>"
td (127:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 19
shouldWrap: true
children:
type: "text"
value: "Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, "
type: "inlineCode"
value: "/b/"
type: "text"
value: " matches the character \"b\". By placing a backslash in front of \"b\", that is by using "
type: "inlineCode"
value: "/\\b/"
type: "text"
value: ", the character becomes special to mean match a word boundary."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, "
type: "inlineCode"
value: "/a*/"
type: "text"
value: " means match 0 or more \"a\"s. To match "
type: "inlineCode"
value: "*"
type: "text"
value: " literally, precede it with a backslash; for example, "
type: "inlineCode"
value: "/a\\*/"
type: "text"
value: " matches \"a*\".",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 19
shouldWrap: true
children:
type: "text"
value: "Note that some characters like "
type: "inlineCode"
value: ":"
type: "text"
value: ", "
type: "inlineCode"
value: "-"
type: "text"
value: ", "
type: "inlineCode"
value: "@"
type: "text"
value: ", etc. neither have a special meaning when escaped nor when unescaped. Escape sequences like "
type: "inlineCode"
value: "\\:"
type: "text"
value: ", "
type: "inlineCode"
value: "\\-"
type: "text"
value: ", "
type: "inlineCode"
value: "\\@"
type: "text"
value: " will be equivalent to their literal, unescaped character equivalents in regular expressions. However, in regular expressions with the "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags_2"
children:
type: "text"
value: "unicode flag"
type: "text"
value: ", these will cause an "
type: "emphasis"
children:
type: "text"
value: "invalid identity escape"
type: "text"
value: " error. This is done to ensure backward compatibility with existing code that uses new escape sequences like "
type: "inlineCode"
value: "\\p"
type: "text"
value: " or "
type: "inlineCode"
value: "\\k"
type: "text"
value: ".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " To match this character literally, escape it with itself. In other words to search for "
type: "inlineCode"
value: "\\"
type: "text"
value: " use "
type: "inlineCode"
value: "/\\\\/"
type: "text"
value: "."
tr (125:3) => tableRow
type: "html"
value: "<td><p>Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.</p><ul><li>For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, <code>/b/</code> matches the character \"b\". By placing a backslash in front of \"b\", that is by using <code>/\\b/</code>, the character becomes special to mean match a word boundary.</li><li>For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, <code>/a*/</code> means match 0 or more \"a\"s. To match <code>*</code> literally, precede it with a backslash; for example, <code>/a\\*/</code> matches \"a*\".</li></ul><p>Note that some characters like <code>:</code>, <code>-</code>, <code>@</code>, etc. neither have a special meaning when escaped nor when unescaped. Escape sequences like <code>\\:</code>, <code>\\-</code>, <code>\\@</code> will be equivalent to their literal, unescaped character equivalents in regular expressions. However, in regular expressions with the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags_2\">unicode flag</a>, these will cause an <em>invalid identity escape</em> error. This is done to ensure backward compatibility with existing code that uses new escape sequences like <code>\\p</code> or <code>\\k</code>.</p><div class=\"notecard note\"><p><strong>Note:</strong> To match this character literally, escape it with itself. In other words to search for <code>\\</code> use <code>/\\\\/</code>.</p></div></td>"
table.standard-table (18:1) => table
type: "html"
value: "<tr><td><code>.</code></td><td><p>Has one of the following meanings:</p><ul><li>Matches any single character <em>except</em> line terminators: <code>\\n</code>, <code>\\r</code>, <code>\\u2028</code> or <code>\\u2029</code>. For example, <code>/.y/</code> matches \"my\" and \"ay\", but not \"yes\", in \"yes make my day\".</li><li>Inside a character class, the dot loses its special meaning and matches a literal dot.</li></ul><p>Note that the <code>m</code> multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character class <code>[^]</code> can be used — it will match any character including newlines.</p><p>ES2018 added the <code>s</code> \"dotAll\" flag, which allows the dot to also match line terminators.</p></td></tr>",type: "html"
value: "<tr><td><code>\\d</code></td><td><p>Matches any digit (Arabic numeral). Equivalent to <code>[0-9]</code>. For example, <code>/\\d/</code> or <code>/[0-9]/</code> matches \"2\" in \"B2 is the suite number\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\D</code></td><td><p>Matches any character that is not a digit (Arabic numeral). Equivalent to <code>[^0-9]</code>. For example, <code>/\\D/</code> or <code>/[^0-9]/</code> matches \"B\" in \"B2 is the suite number\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\w</code></td><td><p>Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to <code>[A-Za-z0-9_]</code>. For example, <code>/\\w/</code> matches \"a\" in \"apple\", \"5\" in \"$5.28\", and \"3\" in \"3D\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\W</code></td><td><p>Matches any character that is not a word character from the basic Latin alphabet. Equivalent to <code>[^A-Za-z0-9_]</code>. For example, <code>/\\W/</code> or <code>/[^A-Za-z0-9_]/</code> matches \"%\" in \"50%\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\s</code></td><td><p>Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to <code>[ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\s\\w*/</code> matches \" bar\" in \"foo bar\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\S</code></td><td><p>Matches a single character other than white space. Equivalent to <code>[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]</code>. For example, <code>/\\S\\w*/</code> matches \"foo\" in \"foo bar\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\c<em>X</em></code></td><td><p>Matches a control character using <a href=\"https://en.wikipedia.org/wiki/Caret_notation\">caret notation</a>, where \"X\" is a letter from A–Z (corresponding to codepoints <code>U+0001</code><em>–</em><code>U+001F</code>). For example, <code>/\\cM/</code> matches \"\\r\" in \"\\r\\n\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\</code></td><td><p>Indicates that the following character should be treated specially, or \"escaped\". It behaves one of two ways.</p><ul><li>For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, <code>/b/</code> matches the character \"b\". By placing a backslash in front of \"b\", that is by using <code>/\\b/</code>, the character becomes special to mean match a word boundary.</li><li>For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, \"*\" is a special character that means 0 or more occurrences of the preceding character should be matched; for example, <code>/a*/</code> means match 0 or more \"a\"s. To match <code>*</code> literally, precede it with a backslash; for example, <code>/a\\*/</code> matches \"a*\".</li></ul><p>Note that some characters like <code>:</code>, <code>-</code>, <code>@</code>, etc. neither have a special meaning when escaped nor when unescaped. Escape sequences like <code>\\:</code>, <code>\\-</code>, <code>\\@</code> will be equivalent to their literal, unescaped character equivalents in regular expressions. However, in regular expressions with the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags_2\">unicode flag</a>, these will cause an <em>invalid identity escape</em> error. This is done to ensure backward compatibility with existing code that uses new escape sequences like <code>\\p</code> or <code>\\k</code>.</p><div class=\"notecard note\"><p><strong>Note:</strong> To match this character literally, escape it with itself. In other words to search for <code>\\</code> use <code>/\\\\/</code>.</p></div></td></tr>"
td (160:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, "
type: "inlineCode"
value: "/^A/"
type: "text"
value: " does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " This character has a different meaning when it appears at the start of a "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges"
children:
type: "text"
value: "group"
type: "text"
value: "."
tr (158:3) => tableRow
type: "html"
value: "<td><p>Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, <code>/^A/</code> does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".</p><div class=\"notecard note\"><p><strong>Note:</strong> This character has a different meaning when it appears at the start of a <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges\">group</a>.</p></div></td>"
td (170:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, "
type: "inlineCode"
value: "/t$/"
type: "text"
value: " does not match the \"t\" in \"eater\", but does match it in \"eat\"."
tr (168:3) => tableRow
type: "html"
value: "<td><p>Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, <code>/t$/</code> does not match the \"t\" in \"eater\", but does match it in \"eat\".</p></td>"
td (176:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Examples:",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/\\bm/"
type: "text"
value: " matches the \"m\" in \"moon\"."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/oo\\b/"
type: "text"
value: " does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/oon\\b/"
type: "text"
value: " matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/\\w\\b\\w/"
type: "text"
value: " will never match anything, because a word character can never be followed by both a non-word and a word character.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "To match a backspace character ("
type: "inlineCode"
value: "[\\b]"
type: "text"
value: "), see "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes"
children:
type: "text"
value: "Character Classes"
type: "text"
value: "."
tr (174:3) => tableRow
type: "html"
value: "<td><p>Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.</p><p>Examples:</p><ul><li><code>/\\bm/</code> matches the \"m\" in \"moon\".</li><li><code>/oo\\b/</code> does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character.</li><li><code>/oon\\b/</code> matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character.</li><li><code>/\\w\\b\\w/</code> will never match anything, because a word character can never be followed by both a non-word and a word character.</li></ul><p>To match a backspace character (<code>[\\b]</code>), see <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes\">Character Classes</a>.</p></td>"
td (193:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, "
type: "inlineCode"
value: "/\\Bon/"
type: "text"
value: " matches \"on\" in \"at noon\", and "
type: "inlineCode"
value: "/ye\\B/"
type: "text"
value: " matches \"ye\" in \"possibly yesterday\"."
tr (191:3) => tableRow
type: "html"
value: "<td><p>Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, <code>/\\Bon/</code> matches \"on\" in \"at noon\", and <code>/ye\\B/</code> matches \"ye\" in \"possibly yesterday\".</p></td>"
table.standard-table (150:1) => table
type: "html"
value: "<tr><td><code>^</code></td><td><p>Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, <code>/^A/</code> does not match the \"A\" in \"an A\", but does match the first \"A\" in \"An A\".</p><div class=\"notecard note\"><p><strong>Note:</strong> This character has a different meaning when it appears at the start of a <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges\">group</a>.</p></div></td></tr>",type: "html"
value: "<tr><td><code>$</code></td><td><p>Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, <code>/t$/</code> does not match the \"t\" in \"eater\", but does match it in \"eat\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\b</code></td><td><p>Matches a word boundary. This is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. Note that a matched word boundary is not included in the match. In other words, the length of a matched word boundary is zero.</p><p>Examples:</p><ul><li><code>/\\bm/</code> matches the \"m\" in \"moon\".</li><li><code>/oo\\b/</code> does not match the \"oo\" in \"moon\", because \"oo\" is followed by \"n\" which is a word character.</li><li><code>/oon\\b/</code> matches the \"oon\" in \"moon\", because \"oon\" is the end of the string, thus not followed by a word character.</li><li><code>/\\w\\b\\w/</code> will never match anything, because a word character can never be followed by both a non-word and a word character.</li></ul><p>To match a backspace character (<code>[\\b]</code>), see <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes\">Character Classes</a>.</p></td></tr>",type: "html"
value: "<tr><td><code>\\B</code></td><td><p>Matches a non-word boundary. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. Same as the matched word boundary, the matched non-word boundary is also not included in the match. For example, <code>/\\Bon/</code> matches \"on\" in \"at noon\", and <code>/ye\\B/</code> matches \"ye\" in \"possibly yesterday\".</p></td></tr>"
td (216:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Lookahead assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is followed by \"y\". For example, /"
type: "inlineCode"
value: "Jack(?=Sprat)/"
type: "text"
value: " matches \"Jack\" only if it is followed by \"Sprat\"."
type: "break"
type: "inlineCode"
value: "/Jack(?=Sprat|Frost)/"
type: "text"
value: " matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results."
tr (214:3) => tableRow
type: "html"
value: "<td><p><strong>Lookahead assertion: </strong>Matches \"x\" only if \"x\" is followed by \"y\". For example, /<code>Jack(?=Sprat)/</code> matches \"Jack\" only if it is followed by \"Sprat\".<br><code>/Jack(?=Sprat|Frost)/</code> matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results.</p></td>"
td (223:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Negative lookahead assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is not followed by \"y\". For example, "
type: "inlineCode"
value: "/\\d+(?!\\.)/"
type: "text"
value: " matches a number only if it is not followed by a decimal point. "
type: "inlineCode"
value: "/\\d+(?!\\.)/.exec('3.141')"
type: "text"
value: " matches \"141\" but not \"3\"."
tr (221:3) => tableRow
type: "html"
value: "<td><p><strong>Negative lookahead assertion: </strong>Matches \"x\" only if \"x\" is not followed by \"y\". For example, <code>/\\d+(?!\\.)/</code> matches a number only if it is not followed by a decimal point. <code>/\\d+(?!\\.)/.exec('3.141')</code> matches \"141\" but not \"3\".</p></td>"
td (229:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Lookbehind assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is preceded by \"y\". For example, "
type: "inlineCode"
value: "/(?<=Jack)Sprat/"
type: "text"
value: " matches \"Sprat\" only if it is preceded by \"Jack\". "
type: "inlineCode"
value: "/(?<=Jack|Tom)Sprat/"
type: "text"
value: " matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results."
tr (227:3) => tableRow
type: "html"
value: "<td><p><strong>Lookbehind assertion: </strong>Matches \"x\" only if \"x\" is preceded by \"y\". For example, <code>/(?<=Jack)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\". <code>/(?<=Jack|Tom)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results.</p></td>"
td (235:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Negative lookbehind assertion:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" only if \"x\" is not preceded by \"y\". For example, "
type: "inlineCode"
value: "/(?<!-)\\d+/"
type: "text"
value: " matches a number only if it is not preceded by a minus sign. "
type: "inlineCode"
value: "/(?<!-)\\d+/.exec('3')"
type: "text"
value: " matches \"3\". "
type: "inlineCode"
value: "/(?<!-)\\d+/.exec('-3')"
type: "text"
value: " match is not found because the number is preceded by the minus sign."
tr (233:3) => tableRow
type: "html"
value: "<td><p><strong>Negative lookbehind assertion: </strong>Matches \"x\" only if \"x\" is not preceded by \"y\". For example, <code>/(?<!-)\\d+/</code> matches a number only if it is not preceded by a minus sign. <code>/(?<!-)\\d+/.exec('3')</code> matches \"3\". <code>/(?<!-)\\d+/.exec('-3')</code> match is not found because the number is preceded by the minus sign.</p></td>"
table.standard-table (206:1) => table
type: "html"
value: "<tr><td><code>x(?=y)</code></td><td><p><strong>Lookahead assertion: </strong>Matches \"x\" only if \"x\" is followed by \"y\". For example, /<code>Jack(?=Sprat)/</code> matches \"Jack\" only if it is followed by \"Sprat\".<br><code>/Jack(?=Sprat|Frost)/</code> matches \"Jack\" only if it is followed by \"Sprat\" or \"Frost\". However, neither \"Sprat\" nor \"Frost\" is part of the match results.</p></td></tr>",type: "html"
value: "<tr><td><code>x(?!y)</code></td><td><p><strong>Negative lookahead assertion: </strong>Matches \"x\" only if \"x\" is not followed by \"y\". For example, <code>/\\d+(?!\\.)/</code> matches a number only if it is not followed by a decimal point. <code>/\\d+(?!\\.)/.exec('3.141')</code> matches \"141\" but not \"3\".</p></td></tr>",type: "html"
value: "<tr><td><code>(?<=y)x</code></td><td><p><strong>Lookbehind assertion: </strong>Matches \"x\" only if \"x\" is preceded by \"y\". For example, <code>/(?<=Jack)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\". <code>/(?<=Jack|Tom)Sprat/</code> matches \"Sprat\" only if it is preceded by \"Jack\" or \"Tom\". However, neither \"Jack\" nor \"Tom\" is part of the match results.</p></td></tr>",type: "html"
value: "<tr><td><code>(?<!y)x</code></td><td><p><strong>Negative lookbehind assertion: </strong>Matches \"x\" only if \"x\" is not preceded by \"y\". For example, <code>/(?<!-)\\d+/</code> matches a number only if it is not preceded by a minus sign. <code>/(?<!-)\\d+/.exec('3')</code> matches \"3\". <code>/(?<!-)\\d+/.exec('-3')</code> match is not found because the number is preceded by the minus sign.</p></td></tr>"
td (255:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches either \"x\" or \"y\". For example, "
type: "inlineCode"
value: "/green|red/"
type: "text"
value: " matches \"green\" in \"green apple\" and \"red\" in \"red apple\"."
tr (253:3) => tableRow
type: "html"
value: "<td><p>Matches either \"x\" or \"y\". For example, <code>/green|red/</code> matches \"green\" in \"green apple\" and \"red\" in \"red apple\".</p></td>"
td (262:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[abcd]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[a-d]"
type: "text"
value: ". They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[abcd-]"
type: "text"
value: " and "
type: "inlineCode"
value: "[-abcd]"
type: "text"
value: " match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[\\w-]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[A-Za-z0-9_-]"
type: "text"
value: ". They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\"."
tr (259:3) => tableRow
type: "html"
value: "<td><p>A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.</p><p>For example, <code>[abcd]</code> is the same as <code>[a-d]</code>. They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".</p><p>For example, <code>[abcd-]</code> and <code>[-abcd]</code> match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".</p><p>For example, <code>[\\w-]</code> is the same as <code>[A-Za-z0-9_-]</code>. They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\".</p></td>"
td (273:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "inlineCode"
value: "[^xyz] [^a-c]"
td (277:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, "
type: "inlineCode"
value: "[^abc]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[^a-c]"
type: "text"
value: ". They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " The ^ character may also indicate the "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions"
children:
type: "text"
value: "beginning of input"
type: "text"
value: "."
tr (272:3) => tableRow
type: "html"
value: "<td><p><code>[^xyz]<br>[^a-c]</code></p></td>",type: "html"
value: "<td><p>A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, <code>[^abc]</code> is the same as <code>[^a-c]</code>. They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".</p><div class=\"notecard note\"><p><strong>Note:</strong> The ^ character may also indicate the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions\">beginning of input</a>.</p></div></td>"
td (287:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Capturing group:"
type: "text"
value: " "
type: "text"
value: "Matches "
type: "inlineCode"
value: "x"
type: "text"
value: " and remembers the match. For example, "
type: "inlineCode"
value: "/(foo)/"
type: "text"
value: " matches and remembers \"foo\" in \"foo bar\". ",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements ("
type: "inlineCode"
value: "[1], ..., [n]"
type: "text"
value: ") or from the predefined "
type: "inlineCode"
value: "RegExp"
type: "text"
value: " object's properties ("
type: "inlineCode"
value: "$1, ..., $9"
type: "text"
value: ").",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match"
children:
type: "inlineCode"
value: "String.match()"
type: "text"
value: " won't return groups if the "
type: "inlineCode"
value: "/.../g"
type: "text"
value: " flag is set. However, you can still use "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll"
children:
type: "inlineCode"
value: "String.matchAll()"
type: "text"
value: " to get all matches."
tr (285:3) => tableRow
type: "html"
value: "<td><p><strong>Capturing group: </strong>Matches <code><em>x</em></code> and remembers the match. For example, <code>/(foo)/</code> matches and remembers \"foo\" in \"foo bar\". </p><p>A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements (<code>[1], ..., [n]</code>) or from the predefined <code>RegExp</code> object's properties (<code>$1, ..., $9</code>).</p><p>Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).</p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match\">String.match()</a></code> won't return groups if the <code>/.../g</code> flag is set. However, you can still use <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll\">String.matchAll()</a></code> to get all matches.</p></td>"
td (299:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, "
type: "inlineCode"
value: "/apple(,)\\sorange\\1/"
type: "text"
value: " matches \"apple, orange,\" in \"apple, orange, cherry, peach\"."
tr (297:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, <code>/apple(,)\\sorange\\1/</code> matches \"apple, orange,\" in \"apple, orange, cherry, peach\".</p></td>"
td (305:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "A back reference to the last substring matching the "
type: "strong"
children:
type: "text"
value: "Named capture group"
type: "text"
value: " "
type: "text"
value: "specified by "
type: "inlineCode"
value: "<Name>"
type: "text"
value: ".",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "/(?<title>\\w+), yes \\k<title>/"
type: "text"
value: " matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " "
type: "inlineCode"
value: "\\k"
type: "text"
value: " is used literally here to indicate the beginning of a back reference to a Named capture group."
tr (303:3) => tableRow
type: "html"
value: "<td><p>A back reference to the last substring matching the <strong>Named capture group </strong>specified by <code><Name></code>.</p><p>For example, <code>/(?<title>\\w+), yes \\k<title>/</code> matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".</p><div class=\"notecard note\"><p><strong>Note:</strong> <code>\\k</code> is used literally here to indicate the beginning of a back reference to a Named capture group.</p></div></td>"
td (317:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 7
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Named capturing group:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" and stores it on the groups property of the returned matches under the name specified by "
type: "inlineCode"
value: "<Name>"
type: "text"
value: ". The angle brackets ("
type: "inlineCode"
value: "<"
type: "text"
value: " and "
type: "inlineCode"
value: ">"
type: "text"
value: ") are required for group name.",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "For example, to extract the United States area code from a phone number, we could use "
type: "inlineCode"
value: "/\\((?<area>\\d\\d\\d)\\)/"
type: "text"
value: ". The resulting number would appear under "
type: "inlineCode"
value: "matches.groups.area"
type: "text"
value: "."
tr (315:3) => tableRow
type: "html"
value: "<td><p><strong>Named capturing group: </strong>Matches \"x\" and stores it on the groups property of the returned matches under the name specified by <code><Name></code>. The angle brackets (<code><</code> and <code>></code>) are required for group name.</p><p>For example, to extract the United States area code from a phone number, we could use <code>/\\((?<area>\\d\\d\\d)\\)/</code>. The resulting number would appear under <code>matches.groups.area</code>.</p></td>"
table.standard-table (245:1) => table
type: "html"
value: "<tr><td><code><em>x</em>|<em>y</em></code></td><td><p>Matches either \"x\" or \"y\". For example, <code>/green|red/</code> matches \"green\" in \"green apple\" and \"red\" in \"red apple\".</p></td></tr>",type: "html"
value: "<tr><td><code>[xyz]<br>[a-c]</code></td><td><p>A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.</p><p>For example, <code>[abcd]</code> is the same as <code>[a-d]</code>. They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".</p><p>For example, <code>[abcd-]</code> and <code>[-abcd]</code> match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".</p><p>For example, <code>[\\w-]</code> is the same as <code>[A-Za-z0-9_-]</code>. They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\".</p></td></tr>",type: "html"
value: "<tr><td><p><code>[^xyz]<br>[^a-c]</code></p></td><td><p>A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, <code>[^abc]</code> is the same as <code>[^a-c]</code>. They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".</p><div class=\"notecard note\"><p><strong>Note:</strong> The ^ character may also indicate the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions\">beginning of input</a>.</p></div></td></tr>",type: "html"
value: "<tr><td><code>(<em>x</em>)</code></td><td><p><strong>Capturing group: </strong>Matches <code><em>x</em></code> and remembers the match. For example, <code>/(foo)/</code> matches and remembers \"foo\" in \"foo bar\". </p><p>A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements (<code>[1], ..., [n]</code>) or from the predefined <code>RegExp</code> object's properties (<code>$1, ..., $9</code>).</p><p>Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).</p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match\">String.match()</a></code> won't return groups if the <code>/.../g</code> flag is set. However, you can still use <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll\">String.matchAll()</a></code> to get all matches.</p></td></tr>",type: "html"
value: "<tr><td><code>\\<em>n</em></code></td><td><p>Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, <code>/apple(,)\\sorange\\1/</code> matches \"apple, orange,\" in \"apple, orange, cherry, peach\".</p></td></tr>",type: "html"
value: "<tr><td>\\k<Name></td><td><p>A back reference to the last substring matching the <strong>Named capture group </strong>specified by <code><Name></code>.</p><p>For example, <code>/(?<title>\\w+), yes \\k<title>/</code> matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".</p><div class=\"notecard note\"><p><strong>Note:</strong> <code>\\k</code> is used literally here to indicate the beginning of a back reference to a Named capture group.</p></div></td></tr>",type: "html"
value: "<tr><td><code>(?<Name>x)</code></td><td><p><strong>Named capturing group: </strong>Matches \"x\" and stores it on the groups property of the returned matches under the name specified by <code><Name></code>. The angle brackets (<code><</code> and <code>></code>) are required for group name.</p><p>For example, to extract the United States area code from a phone number, we could use <code>/\\((?<area>\\d\\d\\d)\\)/</code>. The resulting number would appear under <code>matches.groups.area</code>.</p></td></tr>"
td (347:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 0 or more times. For example, "
type: "inlineCode"
value: "/bo*/"
type: "text"
value: " matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\"."
tr (345:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 0 or more times. For example, <code>/bo*/</code> matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\".</p></td>"
td (353:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 1 or more times. Equivalent to "
type: "inlineCode"
value: "{1,}"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/a+/"
type: "text"
value: " matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\"."
tr (351:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 1 or more times. Equivalent to <code>{1,}</code>. For example, <code>/a+/</code> matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\".</p></td>"
td (359:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 0 or 1 times. For example, "
type: "inlineCode"
value: "/e?le?/"
type: "text"
value: " matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"",type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "If used immediately after any of the quantifiers "
type: "inlineCode"
value: "*"
type: "text"
value: ", "
type: "inlineCode"
value: "+"
type: "text"
value: ", "
type: "inlineCode"
value: "?"
type: "text"
value: ", or "
type: "inlineCode"
value: "{}"
type: "text"
value: ", makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times)."
tr (357:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 0 or 1 times. For example, <code>/e?le?/</code> matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"</p><p>If used immediately after any of the quantifiers <code>*</code>, <code>+</code>, <code>?</code>, or <code>{}</code>, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).</p></td>"
td (367:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{2}/"
type: "text"
value: " doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\"."
tr (365:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2}/</code> doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\".</p></td>"
td (373:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{2,}/"
type: "text"
value: " doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\"."
tr (371:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2,}/</code> doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\".</p></td>"
td (379:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and "
type: "inlineCode"
value: "m > n"
type: "text"
value: ", matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{1,3}/"
type: "text"
value: " matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it."
tr (377:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and <code><em>m</em> > <em>n</em></code>, matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, <code>/a{1,3}/</code> matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it.</p></td>"
td (384:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 7
shouldWrap: true
children:
type: "inlineCode"
value: "x*?"
type: "break"
type: "inlineCode"
value: "x+?"
type: "break"
type: "inlineCode"
value: "x??"
type: "break"
type: "inlineCode"
value: "x{n}?"
type: "break"
type: "inlineCode"
value: "x{n,}?"
type: "break"
type: "inlineCode"
value: "x{n,m}?"
td (392:4) => tableCell
type: "paragraph"
summary: "This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the RegExp guide. If you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "By default quantifiers like "
type: "inlineCode"
value: "*"
type: "text"
value: " and "
type: "inlineCode"
value: "+"
type: "text"
value: " are \"greedy\", meaning that they try to match as much of the string as possible. The "
type: "inlineCode"
value: "?"
type: "text"
value: " character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/<.*>/"
type: "text"
value: " will match \"<foo> <bar> new </bar> </foo>\""
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/<.*?>/"
type: "text"
value: " will match \"<foo>\""
tr (383:3) => tableRow
type: "html"
value: "<td><p><code><em>x</em>*?</code><br><code><em>x</em>+?</code><br><code><em>x</em>??</code><br><code><em>x</em>{n}?</code><br><code><em>x</em>{n,}?</code><br><code><em>x</em>{n,m}?</code></p></td>",type: "html"
value: "<td><p>By default quantifiers like <code>*</code> and <code>+</code> are \"greedy\", meaning that they try to match as much of the string as possible. The <code>?</code> character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":</p><ul><li><code>/<.*>/</code> will match \"<foo> <bar> new </bar> </foo>\"</li><li><code>/<.*?>/</code> will match \"<foo>\"</li></ul></td>"
table.standard-table (337:1) => table
type: "html"
value: "<tr><td><code><em>x</em>*</code></td><td><p>Matches the preceding item \"x\" 0 or more times. For example, <code>/bo*/</code> matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>+</code></td><td><p>Matches the preceding item \"x\" 1 or more times. Equivalent to <code>{1,}</code>. For example, <code>/a+/</code> matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>?</code></td><td><p>Matches the preceding item \"x\" 0 or 1 times. For example, <code>/e?le?/</code> matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"</p><p>If used immediately after any of the quantifiers <code>*</code>, <code>+</code>, <code>?</code>, or <code>{}</code>, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>}</code></td><td><p>Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2}/</code> doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>,}</code></td><td><p>Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2,}/</code> doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>,<em>m</em>}</code></td><td><p>Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and <code><em>m</em> > <em>n</em></code>, matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, <code>/a{1,3}/</code> matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it.</p></td></tr>",type: "html"
value: "<tr><td><p><code><em>x</em>*?</code><br><code><em>x</em>+?</code><br><code><em>x</em>??</code><br><code><em>x</em>{n}?</code><br><code><em>x</em>{n,}?</code><br><code><em>x</em>{n,m}?</code></p></td><td><p>By default quantifiers like <code>*</code> and <code>+</code> are \"greedy\", meaning that they try to match as much of the string as possible. The <code>?</code> character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":</p><ul><li><code>/<.*>/</code> will match \"<foo> <bar> new </bar> </foo>\"</li><li><code>/<.*?>/</code> will match \"<foo>\"</li></ul></td></tr>"
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches either \"x\" or \"y\". For example, "
type: "inlineCode"
value: "/green|red/"
type: "text"
value: " matches \"green\" in \"green apple\" and \"red\" in \"red apple\"."
tr (31:3) => tableRow
type: "html"
value: "<td><p>Matches either \"x\" or \"y\". For example, <code>/green|red/</code> matches \"green\" in \"green apple\" and \"red\" in \"red apple\".</p></td>"
td (40:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[abcd]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[a-d]"
type: "text"
value: ". They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[abcd-]"
type: "text"
value: " and "
type: "inlineCode"
value: "[-abcd]"
type: "text"
value: " match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "[\\w-]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[A-Za-z0-9_-]"
type: "text"
value: ". They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\"."
tr (37:3) => tableRow
type: "html"
value: "<td><p>A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.</p><p>For example, <code>[abcd]</code> is the same as <code>[a-d]</code>. They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".</p><p>For example, <code>[abcd-]</code> and <code>[-abcd]</code> match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".</p><p>For example, <code>[\\w-]</code> is the same as <code>[A-Za-z0-9_-]</code>. They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\".</p></td>"
td (51:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 3
shouldWrap: true
children:
type: "inlineCode"
value: "[^xyz] [^a-c]"
td (55:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, "
type: "inlineCode"
value: "[^abc]"
type: "text"
value: " is the same as "
type: "inlineCode"
value: "[^a-c]"
type: "text"
value: ". They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " The ^ character may also indicate the "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions"
children:
type: "text"
value: "beginning of input"
type: "text"
value: "."
tr (50:3) => tableRow
type: "html"
value: "<td><p><code>[^xyz]<br>[^a-c]</code></p></td>",type: "html"
value: "<td><p>A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, <code>[^abc]</code> is the same as <code>[^a-c]</code>. They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".</p><div class=\"notecard note\"><p><strong>Note:</strong> The ^ character may also indicate the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions\">beginning of input</a>.</p></div></td>"
td (65:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 4
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Capturing group:"
type: "text"
value: " "
type: "text"
value: "Matches "
type: "inlineCode"
value: "x"
type: "text"
value: " and remembers the match. For example, "
type: "inlineCode"
value: "/(foo)/"
type: "text"
value: " matches and remembers \"foo\" in \"foo bar\". ",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements ("
type: "inlineCode"
value: "[1], ..., [n]"
type: "text"
value: ") or from the predefined "
type: "inlineCode"
value: "RegExp"
type: "text"
value: " object's properties ("
type: "inlineCode"
value: "$1, ..., $9"
type: "text"
value: ").",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 4
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match"
children:
type: "inlineCode"
value: "String.match()"
type: "text"
value: " won't return groups if the "
type: "inlineCode"
value: "/.../g"
type: "text"
value: " flag is set. However, you can still use "
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll"
children:
type: "inlineCode"
value: "String.matchAll()"
type: "text"
value: " to get all matches."
tr (63:3) => tableRow
type: "html"
value: "<td><p><strong>Capturing group: </strong>Matches <code><em>x</em></code> and remembers the match. For example, <code>/(foo)/</code> matches and remembers \"foo\" in \"foo bar\". </p><p>A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements (<code>[1], ..., [n]</code>) or from the predefined <code>RegExp</code> object's properties (<code>$1, ..., $9</code>).</p><p>Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).</p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match\">String.match()</a></code> won't return groups if the <code>/.../g</code> flag is set. However, you can still use <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll\">String.matchAll()</a></code> to get all matches.</p></td>"
td (77:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, "
type: "inlineCode"
value: "/apple(,)\\sorange\\1/"
type: "text"
value: " matches \"apple, orange,\" in \"apple, orange, cherry, peach\"."
tr (75:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, <code>/apple(,)\\sorange\\1/</code> matches \"apple, orange,\" in \"apple, orange, cherry, peach\".</p></td>"
td (83:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "A back reference to the last substring matching the "
type: "strong"
children:
type: "text"
value: "Named capture group"
type: "text"
value: " specified by "
type: "inlineCode"
value: "<Name>"
type: "text"
value: ".",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "For example, "
type: "inlineCode"
value: "/(?<title>\\w+), yes \\k<title>/"
type: "text"
value: " matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".",type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Note:"
type: "text"
value: " "
type: "inlineCode"
value: "\\k"
type: "text"
value: " is used literally here to indicate the beginning of a back reference to a Named capture group."
tr (81:3) => tableRow
type: "html"
value: "<td><p>A back reference to the last substring matching the <strong>Named capture group</strong> specified by <code><Name></code>.</p><p>For example, <code>/(?<title>\\w+), yes \\k<title>/</code> matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".</p><div class=\"notecard note\"><p><strong>Note:</strong> <code>\\k</code> is used literally here to indicate the beginning of a back reference to a Named capture group.</p></div></td>"
td (95:4) => tableCell
type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 7
shouldWrap: true
children:
type: "strong"
children:
type: "text"
value: "Named capturing group:"
type: "text"
value: " "
type: "text"
value: "Matches \"x\" and stores it on the groups property of the returned matches under the name specified by "
type: "inlineCode"
value: "<Name>"
type: "text"
value: ". The angle brackets ("
type: "inlineCode"
value: "<"
type: "text"
value: " and "
type: "inlineCode"
value: ">"
type: "text"
value: ") are required for group name.",type: "paragraph"
summary: "Groups and ranges indicate groups and ranges of expression characters."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "For example, to extract the United States area code from a phone number, we could use "
type: "inlineCode"
value: "/\\((?<area>\\d\\d\\d)\\)/"
type: "text"
value: ". The resulting number would appear under "
type: "inlineCode"
value: "matches.groups.area"
type: "text"
value: "."
tr (93:3) => tableRow
type: "html"
value: "<td><p><strong>Named capturing group: </strong>Matches \"x\" and stores it on the groups property of the returned matches under the name specified by <code><Name></code>. The angle brackets (<code><</code> and <code>></code>) are required for group name.</p><p>For example, to extract the United States area code from a phone number, we could use <code>/\\((?<area>\\d\\d\\d)\\)/</code>. The resulting number would appear under <code>matches.groups.area</code>.</p></td>"
table.standard-table (23:1) => table
type: "html"
value: "<tr><td><code><em>x</em>|<em>y</em></code></td><td><p>Matches either \"x\" or \"y\". For example, <code>/green|red/</code> matches \"green\" in \"green apple\" and \"red\" in \"red apple\".</p></td></tr>",type: "html"
value: "<tr><td><code>[xyz]<br>[a-c]</code></td><td><p>A character class. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character.</p><p>For example, <code>[abcd]</code> is the same as <code>[a-d]</code>. They match the \"b\" in \"brisket\", and the \"c\" in \"chop\".</p><p>For example, <code>[abcd-]</code> and <code>[-abcd]</code> match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"-\" (hyphen) in \"non-profit\".</p><p>For example, <code>[\\w-]</code> is the same as <code>[A-Za-z0-9_-]</code>. They both match the \"b\" in \"brisket\", the \"c\" in \"chop\", and the \"n\" in \"non-profit\".</p></td></tr>",type: "html"
value: "<tr><td><p><code>[^xyz]<br>[^a-c]</code></p></td><td><p>A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, <code>[^abc]</code> is the same as <code>[^a-c]</code>. They initially match \"o\" in \"bacon\" and \"h\" in \"chop\".</p><div class=\"notecard note\"><p><strong>Note:</strong> The ^ character may also indicate the <a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions\">beginning of input</a>.</p></div></td></tr>",type: "html"
value: "<tr><td><code>(<em>x</em>)</code></td><td><p><strong>Capturing group: </strong>Matches <code><em>x</em></code> and remembers the match. For example, <code>/(foo)/</code> matches and remembers \"foo\" in \"foo bar\". </p><p>A regular expression may have multiple capturing groups. In results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. This is usually just the order of the capturing groups themselves. This becomes important when capturing groups are nested. Matches are accessed using the index of the result's elements (<code>[1], ..., [n]</code>) or from the predefined <code>RegExp</code> object's properties (<code>$1, ..., $9</code>).</p><p>Capturing groups have a performance penalty. If you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).</p><p><code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match\">String.match()</a></code> won't return groups if the <code>/.../g</code> flag is set. However, you can still use <code><a href=\"/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll\">String.matchAll()</a></code> to get all matches.</p></td></tr>",type: "html"
value: "<tr><td><code>\\<em>n</em></code></td><td><p>Where \"n\" is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, <code>/apple(,)\\sorange\\1/</code> matches \"apple, orange,\" in \"apple, orange, cherry, peach\".</p></td></tr>",type: "html"
value: "<tr><td><code>\\k<Name></code></td><td><p>A back reference to the last substring matching the <strong>Named capture group</strong> specified by <code><Name></code>.</p><p>For example, <code>/(?<title>\\w+), yes \\k<title>/</code> matches \"Sir, yes Sir\" in \"Do you copy? Sir, yes Sir!\".</p><div class=\"notecard note\"><p><strong>Note:</strong> <code>\\k</code> is used literally here to indicate the beginning of a back reference to a Named capture group.</p></div></td></tr>",type: "html"
value: "<tr><td><code>(?<Name>x)</code></td><td><p><strong>Named capturing group: </strong>Matches \"x\" and stores it on the groups property of the returned matches under the name specified by <code><Name></code>. The angle brackets (<code><</code> and <code>></code>) are required for group name.</p><p>For example, to extract the United States area code from a phone number, we could use <code>/\\((?<area>\\d\\d\\d)\\)/</code>. The resulting number would appear under <code>matches.groups.area</code>.</p></td></tr>"
type: "paragraph"
summary: "Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the {{anN4cmVmKCJSZWdFeHAuZXhlYyIsICJleGVjKCkiKQ==}} and {{anN4cmVmKCJSZWdFeHAudGVzdCIsICJ0ZXN0KCkiKQ==}} methods of {{anN4cmVmKCJSZWdFeHAiKQ==}}, and with the {{anN4cmVmKCJTdHJpbmcubWF0Y2giLCAibWF0Y2goKSIp}}, {{anN4cmVmKCJTdHJpbmcubWF0Y2hBbGwiLCAibWF0Y2hBbGwoKSIp}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZSIsICJyZXBsYWNlKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZUFsbCIsICJyZXBsYWNlQWxsKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcuc2VhcmNoIiwgInNlYXJjaCgpIik=}}, and {{anN4cmVmKCJTdHJpbmcuc3BsaXQiLCAic3BsaXQoKSIp}} methods of {{anN4cmVmKCJTdHJpbmciKQ==}}. This chapter describes JavaScript regular expressions."
rowIndex: 1
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes"
children:
type: "text"
value: "Character classes"
type: "paragraph"
summary: "Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the {{anN4cmVmKCJSZWdFeHAuZXhlYyIsICJleGVjKCkiKQ==}} and {{anN4cmVmKCJSZWdFeHAudGVzdCIsICJ0ZXN0KCkiKQ==}} methods of {{anN4cmVmKCJSZWdFeHAiKQ==}}, and with the {{anN4cmVmKCJTdHJpbmcubWF0Y2giLCAibWF0Y2goKSIp}}, {{anN4cmVmKCJTdHJpbmcubWF0Y2hBbGwiLCAibWF0Y2hBbGwoKSIp}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZSIsICJyZXBsYWNlKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZUFsbCIsICJyZXBsYWNlQWxsKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcuc2VhcmNoIiwgInNlYXJjaCgpIik=}}, and {{anN4cmVmKCJTdHJpbmcuc3BsaXQiLCAic3BsaXQoKSIp}} methods of {{anN4cmVmKCJTdHJpbmciKQ==}}. This chapter describes JavaScript regular expressions."
rowIndex: 2
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions"
children:
type: "text"
value: "Assertions"
type: "paragraph"
summary: "Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the {{anN4cmVmKCJSZWdFeHAuZXhlYyIsICJleGVjKCkiKQ==}} and {{anN4cmVmKCJSZWdFeHAudGVzdCIsICJ0ZXN0KCkiKQ==}} methods of {{anN4cmVmKCJSZWdFeHAiKQ==}}, and with the {{anN4cmVmKCJTdHJpbmcubWF0Y2giLCAibWF0Y2goKSIp}}, {{anN4cmVmKCJTdHJpbmcubWF0Y2hBbGwiLCAibWF0Y2hBbGwoKSIp}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZSIsICJyZXBsYWNlKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZUFsbCIsICJyZXBsYWNlQWxsKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcuc2VhcmNoIiwgInNlYXJjaCgpIik=}}, and {{anN4cmVmKCJTdHJpbmcuc3BsaXQiLCAic3BsaXQoKSIp}} methods of {{anN4cmVmKCJTdHJpbmciKQ==}}. This chapter describes JavaScript regular expressions."
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges"
children:
type: "text"
value: "Groups and ranges"
tr (95:3) => tableRow
type: "html"
value: "<td><p><a href=\"/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges\">Groups and ranges</a></p></td>"
td (103:4) => tableCell
type: "paragraph"
summary: "Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the {{anN4cmVmKCJSZWdFeHAuZXhlYyIsICJleGVjKCkiKQ==}} and {{anN4cmVmKCJSZWdFeHAudGVzdCIsICJ0ZXN0KCkiKQ==}} methods of {{anN4cmVmKCJSZWdFeHAiKQ==}}, and with the {{anN4cmVmKCJTdHJpbmcubWF0Y2giLCAibWF0Y2goKSIp}}, {{anN4cmVmKCJTdHJpbmcubWF0Y2hBbGwiLCAibWF0Y2hBbGwoKSIp}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZSIsICJyZXBsYWNlKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcucmVwbGFjZUFsbCIsICJyZXBsYWNlQWxsKCkiKQ==}}, {{anN4cmVmKCJTdHJpbmcuc2VhcmNoIiwgInNlYXJjaCgpIik=}}, and {{anN4cmVmKCJTdHJpbmcuc3BsaXQiLCAic3BsaXQoKSIp}} methods of {{anN4cmVmKCJTdHJpbmciKQ==}}. This chapter describes JavaScript regular expressions."
rowIndex: 4
shouldWrap: true
children:
type: "link"
title:
url: "/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Quantifiers"
children:
type: "text"
value: "Quantifiers"
type: "html"
value: "<tr><td rowspan=\"4\"><code>myArray</code></td><td></td><td>The matched string and all remembered substrings.</td><td><code>['dbbd', 'bb', index: 1, input: 'cdbbdbsbz']</code></td></tr>",type: "html"
value: "<tr><td rowspan=\"2\"><code>myRe</code></td><td><code>lastIndex</code></td><td>The index at which to start the next match. (This property is set only if the regular expression uses the g option, described in <a href=\"#advanced_searching_with_flags\">Advanced Searching With Flags</a>.)</td><td><code>5</code></td></tr>"
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 0 or more times. For example, "
type: "inlineCode"
value: "/bo*/"
type: "text"
value: " matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\"."
tr (34:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 0 or more times. For example, <code>/bo*/</code> matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\".</p></td>"
td (42:4) => tableCell
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 1 or more times. Equivalent to "
type: "inlineCode"
value: "{1,}"
type: "text"
value: ". For example, "
type: "inlineCode"
value: "/a+/"
type: "text"
value: " matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\"."
tr (40:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 1 or more times. Equivalent to <code>{1,}</code>. For example, <code>/a+/</code> matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\".</p></td>"
td (48:4) => tableCell
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "Matches the preceding item \"x\" 0 or 1 times. For example, "
type: "inlineCode"
value: "/e?le?/"
type: "text"
value: " matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"",type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 3
shouldWrap: true
children:
type: "text"
value: "If used immediately after any of the quantifiers "
type: "inlineCode"
value: "*"
type: "text"
value: ", "
type: "inlineCode"
value: "+"
type: "text"
value: ", "
type: "inlineCode"
value: "?"
type: "text"
value: ", or "
type: "inlineCode"
value: "{}"
type: "text"
value: ", makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times)."
tr (46:3) => tableRow
type: "html"
value: "<td><p>Matches the preceding item \"x\" 0 or 1 times. For example, <code>/e?le?/</code> matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"</p><p>If used immediately after any of the quantifiers <code>*</code>, <code>+</code>, <code>?</code>, or <code>{}</code>, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).</p></td>"
td (56:4) => tableCell
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{2}/"
type: "text"
value: " doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\"."
tr (54:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2}/</code> doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\".</p></td>"
td (62:4) => tableCell
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 5
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{2,}/"
type: "text"
value: " doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\"."
tr (60:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2,}/</code> doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\".</p></td>"
td (68:4) => tableCell
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 6
shouldWrap: true
children:
type: "text"
value: "Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and "
type: "inlineCode"
value: "m > n"
type: "text"
value: ", matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, "
type: "inlineCode"
value: "/a{1,3}/"
type: "text"
value: " matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it."
tr (66:3) => tableRow
type: "html"
value: "<td><p>Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and <code><em>m</em> > <em>n</em></code>, matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, <code>/a{1,3}/</code> matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it.</p></td>"
type: "paragraph"
summary: "Quantifiers indicate numbers of characters or expressions to match."
rowIndex: 7
shouldWrap: true
children:
type: "text"
value: "By default quantifiers like "
type: "inlineCode"
value: "*"
type: "text"
value: " and "
type: "inlineCode"
value: "+"
type: "text"
value: " are \"greedy\", meaning that they try to match as much of the string as possible. The "
type: "inlineCode"
value: "?"
type: "text"
value: " character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":",type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/<.*>/"
type: "text"
value: " will match \"<foo> <bar> new </bar> </foo>\""
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "/<.*?>/"
type: "text"
value: " will match \"<foo>\""
tr (72:3) => tableRow
type: "html"
value: "<td><p><code><em>x</em>*?</code><br><code><em>x</em>+?</code><br><code><em>x</em>??</code><br><code><em>x</em>{n}?</code><br><code><em>x</em>{n,}?</code><br><code><em>x</em>{n,m}?</code></p></td>",type: "html"
value: "<td><p>By default quantifiers like <code>*</code> and <code>+</code> are \"greedy\", meaning that they try to match as much of the string as possible. The <code>?</code> character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":</p><ul><li><code>/<.*>/</code> will match \"<foo> <bar> new </bar> </foo>\"</li><li><code>/<.*?>/</code> will match \"<foo>\"</li></ul></td>"
table.standard-table (26:1) => table
type: "html"
value: "<tr><td><code><em>x</em>*</code></td><td><p>Matches the preceding item \"x\" 0 or more times. For example, <code>/bo*/</code> matches \"boooo\" in \"A ghost booooed\" and \"b\" in \"A bird warbled\", but nothing in \"A goat grunted\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>+</code></td><td><p>Matches the preceding item \"x\" 1 or more times. Equivalent to <code>{1,}</code>. For example, <code>/a+/</code> matches the \"a\" in \"candy\" and all the \"a\"'s in \"caaaaaaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>?</code></td><td><p>Matches the preceding item \"x\" 0 or 1 times. For example, <code>/e?le?/</code> matches the \"el\" in \"angel\" and the \"le\" in \"angle.\"</p><p>If used immediately after any of the quantifiers <code>*</code>, <code>+</code>, <code>?</code>, or <code>{}</code>, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>}</code></td><td><p>Where \"n\" is a positive integer, matches exactly \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2}/</code> doesn't match the \"a\" in \"candy\", but it matches all of the \"a\"'s in \"caandy\", and the first two \"a\"'s in \"caaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>,}</code></td><td><p>Where \"n\" is a positive integer, matches at least \"n\" occurrences of the preceding item \"x\". For example, <code>/a{2,}/</code> doesn't match the \"a\" in \"candy\", but matches all of the a's in \"caandy\" and in \"caaaaaaandy\".</p></td></tr>",type: "html"
value: "<tr><td><code><em>x</em>{<em>n</em>,<em>m</em>}</code></td><td><p>Where \"n\" is 0 or a positive integer, \"m\" is a positive integer, and <code><em>m</em> > <em>n</em></code>, matches at least \"n\" and at most \"m\" occurrences of the preceding item \"x\". For example, <code>/a{1,3}/</code> matches nothing in \"cndy\", the \"a\" in \"candy\", the two \"a\"'s in \"caandy\", and the first three \"a\"'s in \"caaaaaaandy\". Notice that when matching \"caaaaaaandy\", the match is \"aaa\", even though the original string had more \"a\"s in it.</p></td></tr>",type: "html"
value: "<tr><td><p><code><em>x</em>*?</code><br><code><em>x</em>+?</code><br><code><em>x</em>??</code><br><code><em>x</em>{n}?</code><br><code><em>x</em>{n,}?</code><br><code><em>x</em>{n,m}?</code></p></td><td><p>By default quantifiers like <code>*</code> and <code>+</code> are \"greedy\", meaning that they try to match as much of the string as possible. The <code>?</code> character after the quantifier makes the quantifier \"non-greedy\": meaning that it will stop as soon as it finds a match. For example, given a string like \"some <foo> <bar> new </bar> </foo> thing\":</p><ul><li><code>/<.*>/</code> will match \"<foo> <bar> new </bar> </foo>\"</li><li><code>/<.*?>/</code> will match \"<foo>\"</li></ul></td></tr>"
type: "paragraph"
summary: "This chapter introduces how to work with strings and text in JavaScript."
rowIndex: 10
shouldWrap: true
children:
type: "text"
value: "Return the string in all lowercase or all uppercase, respectively."
tr (131:3) => tableRow
type: "html"
value: "<td><p>Return the string in all lowercase or all uppercase, respectively.</p></td>"
table.standard-table (84:1) => table
type: "html"
value: "<tr><td>{{anN4cmVmKCJTdHJpbmcudG9Mb3dlckNhc2UiLCAidG9Mb3dlckNhc2UiKQ==}}, {{anN4cmVmKCJTdHJpbmcudG9VcHBlckNhc2UiLCAidG9VcHBlckNhc2UiKQ==}}</td><td><p>Return the string in all lowercase or all uppercase, respectively.</p></td></tr>"
type: "html"
value: "<th scope=\"row\">Pro(s)</th>",type: "html"
value: "<td>Supported in all browsers — including older browsers (going all the way back to IE 5.5). Also, it is very fast, very standard, and very JIT-optimizable.</td>"
td (408:7) => tableCell
type: "paragraph"
summary: "JavaScript is a bit confusing for developers experienced in class-based languages (like Java or C++), as it is dynamic and does not provide a class implementation per se (the class keyword is introduced in ES2015, but is syntactical sugar, JavaScript remains prototype-based)."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Both of those are generally not problems in practice."
tr (406:7) => tableRow
type: "html"
value: "<th scope=\"row\">Con(s)</th>",type: "html"
value: "<td><div>1. In order to use this method, the function in question must be initialized. During this initialization, the constructor may store unique information that must be generated per-object. This unique information would only be generated once, potentially leading to problems.</div><div>2. The initialization of the constructor may put unwanted methods onto the object.</div><p>Both of those are generally not problems in practice.</p></td>"
table.standard-table (399:1) => table
type: "html"
value: "<tr><th scope=\"row\">Pro(s)</th><td>Supported in all browsers — including older browsers (going all the way back to IE 5.5). Also, it is very fast, very standard, and very JIT-optimizable.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Con(s)</th><td><div>1. In order to use this method, the function in question must be initialized. During this initialization, the constructor may store unique information that must be generated per-object. This unique information would only be generated once, potentially leading to problems.</div><div>2. The initialization of the constructor may put unwanted methods onto the object.</div><p>Both of those are generally not problems in practice.</p></td></tr>"
tr (450:5) => tableRow
type: "html"
value: "<th scope=\"row\">Pro(s)</th>",type: "html"
value: "<td>Supported in all modern browsers. Allows the direct setting of <code>__proto__</code> in a way that is a single event, which permits the browser to further optimize the object. Also allows the creation of objects without a prototype, using <code>Object.create(null)</code>.</td>"
type: "html"
value: "<tr><th scope=\"row\">Pro(s)</th><td>Supported in all modern browsers. Allows the direct setting of <code>__proto__</code> in a way that is a single event, which permits the browser to further optimize the object. Also allows the creation of objects without a prototype, using <code>Object.create(null)</code>.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Con(s)</th><td>Not supported in IE8 and below. However, as Microsoft has discontinued extended support for systems running IE8 and below, that should not be a concern for most applications. Additionally, the slow object initialization can be a performance black hole if using the second argument, because each object-descriptor property has its own separate descriptor object. When dealing with hundreds of thousands of object descriptors in the form of objects, that lag time might become a serious issue.</td></tr>"
tr (494:5) => tableRow
type: "html"
value: "<th scope=\"row\">Pro(s)</th>",type: "html"
value: "<td>Supported in all modern browsers. Allows the dynamic manipulation of an object’s prototype and can even force a prototype on a prototype-less object created with <code>Object.create(null)</code>.</td>"
type: "html"
value: "<tr><th scope=\"row\">Pro(s)</th><td>Supported in all modern browsers. Allows the dynamic manipulation of an object’s prototype and can even force a prototype on a prototype-less object created with <code>Object.create(null)</code>.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Con(s)</th><td>Ill-performing. Should be deprecated. Many browsers optimize the prototype and try to guess the location of the method in memory when calling an instance in advance; but setting the prototype dynamically disrupts all those optimizations. It might cause some browsers to recompile your code for de-optimization, to make it work according to the specs. Not supported in IE8 and below.</td></tr>"
tr (535:5) => tableRow
type: "html"
value: "<th scope=\"row\">Pro(s)</th>",type: "html"
value: "<td>Supported in all modern browsers. Setting {{anN4cmVmKCJPYmplY3QvcHJvdG8iLCJfX3Byb3RvX18iKQ==}}\nto something that is not an object only fails silently. It does not throw an exception.</td>"
type: "html"
value: "<tr><th scope=\"row\">Pro(s)</th><td>Supported in all modern browsers. Setting {{anN4cmVmKCJPYmplY3QvcHJvdG8iLCJfX3Byb3RvX18iKQ==}}\nto something that is not an object only fails silently. It does not throw an exception.</td></tr>",type: "html"
value: "<tr><th scope=\"row\">Con(s)</th><td>Non-performant and deprecated. Many browsers optimize the prototype and try to guess the location of the method in the memory when calling an instance in advance; but setting the prototype dynamically disrupts all those optimizations and can even force some browsers to recompile for de-optimization of your code, to make it work according to the specs. Not supported in IE10 and below.</td></tr>"
type: "paragraph"
summary: "ECMAScript is the scripting language that forms the basis of JavaScript. ECMAScript standardized by the ECMA International standards organization in the ECMA-262 and ECMA-402 specifications. The following ECMAScript standards have been approved or are being worked on:"
rowIndex: 2
shouldWrap: true
children:
type: "link"
title:
url: "https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf"
children:
type: "text"
value: "PDF"
type: "text"
value: ", "
type: "link"
title:
url: "https://ecma-international.org/ecma-262/11.0/index.html"
children:
type: "text"
value: "HTML"
type: "text"
value: ", "
type: "link"
title:
url: "https://tc39.github.io/ecma262/"
children:
type: "text"
value: "Working draft"
type: "text"
value: ", "
type: "link"
title:
url: "https://github.com/tc39/ecma262"
children:
type: "text"
value: "repository"
type: "paragraph"
summary: "ECMAScript is the scripting language that forms the basis of JavaScript. ECMAScript standardized by the ECMA International standards organization in the ECMA-262 and ECMA-402 specifications. The following ECMAScript standards have been approved or are being worked on:"
rowIndex: 3
shouldWrap: true
children:
type: "link"
title:
url: "https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf"
children:
type: "text"
value: "PDF"
type: "text"
value: ", "
type: "link"
title:
url: "https://ecma-international.org/ecma-262/10.0/index.html"
children:
type: "text"
value: "HTML"
type: "text"
value: ", "
type: "link"
title:
url: "https://tc39.github.io/ecma262/"
children:
type: "text"
value: "Working draft"
type: "text"
value: ", "
type: "link"
title:
url: "https://github.com/tc39/ecma262"
children:
type: "text"
value: "repository"
type: "paragraph"
summary: "ECMAScript is the scripting language that forms the basis of JavaScript. ECMAScript standardized by the ECMA International standards organization in the ECMA-262 and ECMA-402 specifications. The following ECMAScript standards have been approved or are being worked on:"
rowIndex: 4
shouldWrap: true
children:
type: "link"
title:
url: "http://ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf"
children:
type: "text"
value: "PDF"
type: "text"
value: ", "
type: "link"
title:
url: "http://ecma-international.org/ecma-262/9.0/index.html#Title"
children:
type: "text"
value: "HTML"
type: "text"
value: ", "
type: "break"
type: "link"
title:
url: "https://tc39.github.io/ecma262/"
children:
type: "text"
value: "Working draft"
type: "text"
value: ", "
type: "link"
title:
url: "https://github.com/tc39/ecma262"
children:
type: "text"
value: "repository"
type: "paragraph"
summary: "This page lists features of JavaScript that are deprecated (that is, still available but planned for removal) and obsolete (that is, no longer usable)."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Parenthesized substring matches, if any."
type: "break"
type: "strong"
children:
type: "text"
value: "Warning:"
type: "text"
value: " Using these properties can result in problems, since browser extensions can modify them. Avoid them!"
tr (29:3) => tableRow
type: "html"
value: "<td><p>Parenthesized substring matches, if any.<br><strong>Warning:</strong> Using these properties can result in problems, since browser extensions can modify them. Avoid them!</p></td>"
table.standard-table (23:1) => table
type: "html"
value: "<tr><td>{{anN4cmVmKCJSZWdFeHAubiIsICIkMS0kOSIp}}</td><td><p>Parenthesized substring matches, if any.<br><strong>Warning:</strong> Using these properties can result in problems, since browser extensions can modify them. Avoid them!</p></td></tr>"
type: "list"
ordered: false
start:
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Has the value "
type: "inlineCode"
value: "true"
type: "text"
value: " if the iterator is past the end of the iterated\nsequence. In this case "
type: "inlineCode"
value: "value"
type: "text"
value: " optionally specifies the "
type: "emphasis"
children:
type: "text"
value: "return\nvalue"
type: "text"
value: " of the iterator."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "text"
value: "Has the value "
type: "inlineCode"
value: "false"
type: "text"
value: " if the iterator was able to produce the next\nvalue in the sequence. This is equivalent of not specifying the "
type: "inlineCode"
value: "done"
type: "text"
value: "\nproperty altogether."
type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Warning:"
type: "text"
value: " The "
type: "inlineCode"
value: "islamicc"
type: "text"
value: " calendar key has been deprecated. Please use "
type: "inlineCode"
value: "islamic-civil"
type: "text"
value: ".",type: "paragraph"
summary: "The Intl.Locale.prototype.calendar property is an accessor property which returns the type of calendar used in the Locale."
rowIndex: 19
shouldWrap: true
children:
type: "inlineCode"
value: "islamicc"
tr (107:3) => tableRow
type: "html"
value: "<td><div class=\"notecard warning\"><p><strong>Warning:</strong> The <code>islamicc</code> calendar key has been deprecated. Please use <code>islamic-civil</code>.</p></div><p><code>islamicc</code></p></td>"
table.standard-table (26:1) => table
type: "html"
value: "<tr><td><div class=\"notecard warning\"><p><strong>Warning:</strong> The <code>islamicc</code> calendar key has been deprecated. Please use <code>islamic-civil</code>.</p></div><p><code>islamicc</code></p></td><td>Civil (algorithmic) Arabic calendar</td></tr>"
type: "blockquote"
children:
type: "paragraph"
children:
type: "strong"
children:
type: "text"
value: "Warning:"
type: "text"
value: " The "
type: "inlineCode"
value: "direct"
type: "text"
value: " collation type has been deprected. Do not use.",type: "paragraph"
summary: "The Intl.Locale.prototype.collation property is an accessor property that returns the collation type for the Locale, which is used to order strings according to the locale's rules."
rowIndex: 4
shouldWrap: true
children:
type: "text"
value: "direct"
tr (48:3) => tableRow
type: "html"
value: "<td><div class=\"notecard warning\"><p><strong>Warning:</strong> The <code>direct</code> collation type has been deprected. Do not use.</p></div><p>direct</p></td>"
td (115:4) => tableCell
type: "paragraph"
summary: "The Intl.Locale.prototype.collation property is an accessor property that returns the collation type for the Locale, which is used to order strings according to the locale's rules."
rowIndex: 19
shouldWrap: true
children:
type: "text"
value: "Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)"
tr (113:3) => tableRow
type: "html"
value: "<td><p>Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)</p></td>"
table.standard-table (28:1) => table
type: "html"
value: "<tr><td><div class=\"notecard warning\"><p><strong>Warning:</strong> The <code>direct</code> collation type has been deprected. Do not use.</p></div><p>direct</p></td><td>Binary code point order (used in Hindi)</td></tr>",type: "html"
value: "<tr><td>zhuyin</td><td><p>Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)</p></td></tr>"
type: "paragraph"
summary: "The {{anN4cmVmKCJSZWZsZWN0Iik=}} object, introduced in ES2015, is a built-in object that provides methods to interface with JavaScript objects. Some of the static functions that exist on Reflect also correspond to methods available on {{anN4cmVmKCJPYmplY3QiKQ==}}, which predates ES2015. Although some of the methods appear to be similar in their behavior, there are often subtle differences between them."
rowIndex: 10
shouldWrap: true
children:
type: "text"
value: "{{anN4cmVmKCJSZWZsZWN0LmlzRXh0ZW5zaWJsZSgpIik=}} returns "
type: "inlineCode"
value: "true"
type: "text"
value: " if the object is extensible, and "
type: "inlineCode"
value: "false"
type: "text"
value: " if it is not. Throws a "
type: "inlineCode"
value: "TypeError"
type: "text"
value: " if the first argument is not an object (a primitive)."
tr (74:3) => tableRow
type: "html"
value: "<td><p>{{anN4cmVmKCJSZWZsZWN0LmlzRXh0ZW5zaWJsZSgpIik=}} returns <code>true</code> if the object is extensible, and <code>false</code> if it is not. Throws a <code>TypeError</code> if the first argument is not an object (a primitive).</p></td>"
td (83:4) => tableCell
type: "paragraph"
summary: "The {{anN4cmVmKCJSZWZsZWN0Iik=}} object, introduced in ES2015, is a built-in object that provides methods to interface with JavaScript objects. Some of the static functions that exist on Reflect also correspond to methods available on {{anN4cmVmKCJPYmplY3QiKQ==}}, which predates ES2015. Although some of the methods appear to be similar in their behavior, there are often subtle differences between them."
rowIndex: 11
shouldWrap: true
children:
type: "text"
value: "{{anN4cmVmKCJPYmplY3QucHJldmVudEV4dGVuc2lvbnMoKSIp}} returns the object that is being made non-extensible. Throws a "
type: "inlineCode"
value: "TypeError"
type: "text"
value: "in ES5 if the argument is not an object (a primitive). In ES2015, treats the argument as a non-extensible, ordinary object and returns the object itself."
tr (81:3) => tableRow
type: "html"
value: "<td><p>{{anN4cmVmKCJPYmplY3QucHJldmVudEV4dGVuc2lvbnMoKSIp}} returns the object that is being made non-extensible. Throws a <code>TypeError</code>in ES5 if the argument is not an object (a primitive). In ES2015, treats the argument as a non-extensible, ordinary object and returns the object itself.</p></td>"
table.standard-table (20:1) => table
type: "html"
value: "<tr><td><code>isExtensible()</code></td><td>{{anN4cmVmKCJPYmplY3QuaXNFeHRlbnNpYmxlKCkiKQ==}} returns <code>true</code> if the object is extensible, and <code>false</code> if it is not. Throws a <code>TypeError</code> in ES5 if the first argument is not an object (a primitive). In ES2015, it will be coerced into a non-extensible, ordinary object and will return <code>false</code>.</td><td><p>{{anN4cmVmKCJSZWZsZWN0LmlzRXh0ZW5zaWJsZSgpIik=}} returns <code>true</code> if the object is extensible, and <code>false</code> if it is not. Throws a <code>TypeError</code> if the first argument is not an object (a primitive).</p></td></tr>",type: "html"
value: "<tr><td><code>preventExtensions()</code></td><td><p>{{anN4cmVmKCJPYmplY3QucHJldmVudEV4dGVuc2lvbnMoKSIp}} returns the object that is being made non-extensible. Throws a <code>TypeError</code>in ES5 if the argument is not an object (a primitive). In ES2015, treats the argument as a non-extensible, ordinary object and returns the object itself.</p></td><td>{{anN4cmVmKCJSZWZsZWN0LnByZXZlbnRFeHRlbnNpb25zKCkiKQ==}} returns <code>true</code> if the object has been made non-extensible, and <code>false</code> if it has not. Throws a <code>TypeError</code> if the argument is not an object (a primitive).</td></tr>"
type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "The parenthesized substring matches, if any.",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 2
shouldWrap: true
children:
type: "text"
value: "The number of possible parenthesized substrings is unlimited."
td (95:7) => tableCell
type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 2
shouldWrap: true
children:
type: "inlineCode"
value: "result[1] === \"Brown\"",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 2
shouldWrap: true
children:
type: "inlineCode"
value: "result[2] === \"Jumps\""
tr (88:5) => tableRow
type: "html"
value: "<td><p>The parenthesized substring matches, if any.</p><p>The number of possible parenthesized substrings is unlimited.</p></td>",type: "html"
value: "<td><p><code>result[1] === \"Brown\"</code></p><p><code>result[2] === \"Jumps\"</code></p></td>"
td (118:7) => tableCell
type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 4
shouldWrap: true
children:
type: "inlineCode"
value: "indices[0] === Array [ 4, 25 ]",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 4
shouldWrap: true
children:
type: "inlineCode"
value: "indices[1] === Array [ 10, 15 ]",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 4
shouldWrap: true
children:
type: "inlineCode"
value: "indices[2] === Array [ 20, 25 ]",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 4
shouldWrap: true
children:
type: "inlineCode"
value: "indices.groups === undefined",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 4
shouldWrap: true
children:
type: "inlineCode"
value: "indices.length === 3"
type: "html"
value: "<tr><td><code>[1], ...[<var>n</var>]</code></td><td><p>The parenthesized substring matches, if any.</p><p>The number of possible parenthesized substrings is unlimited.</p></td><td><p><code>result[1] === \"Brown\"</code></p><p><code>result[2] === \"Jumps\"</code></p></td></tr>",type: "html"
value: "<tr><td><code>indices</code></td><td>An array where each entry represents a substring match.\nEach substring match itself is an array where the first entry\nrepresents its start index and the second entry its end index.<br>The <code>indices</code> array additionally has a <code>groups</code>\nproperty which holds an object of all named capturing groups. The keys\nare the names of the capturing groups and each value is an array with\nthe first item being the start entry and the second entry being the\nend index of the capturing group. If the regular expression doesn't\ncontain any capturing groups, <code>groups</code> is <code>undefined</code>.</td><td><p><code>indices[0] === Array [ 4, 25 ]</code></p><p><code>indices[1] === Array [ 10, 15 ]</code></p><p><code>indices[2] === Array [ 20, 25 ]</code></p><p><code>indices.groups === undefined</code></p><p><code>indices.length === 3</code></p></td></tr>"
td (147:7) => tableCell
type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "The index at which to start the next match.",type: "paragraph"
summary: "The exec() method executes a\n search for a match in a specified string. Returns a result array, or\n {{anN4cmVmKCJudWxsIik=}}."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "If "
type: "inlineCode"
value: "g"
type: "text"
value: " is absent, this will always be "
type: "inlineCode"
value: "0"
type: "text"
value: "."
tr (145:5) => tableRow
type: "html"
value: "<td><p>The index at which to start the next match.</p><p>If <code>g</code> is absent, this will always be <code>0</code>.</p></td>"
table.standard-table (136:1) => table
type: "html"
value: "<tr><td><code>lastIndex</code></td><td><p>The index at which to start the next match.</p><p>If <code>g</code> is absent, this will always be <code>0</code>.</p></td><td><code>25</code></td></tr>"
type: "paragraph"
summary: "As a couple of additions to ECMAScript 2015, Iteration protocols aren't new built-ins or syntax, but protocols. These protocols can be implemented by any object by following some conventions."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "A function, with either zero arguments or one argument, that returns an object with at least the following two properties. If the "
type: "inlineCode"
value: "next()"
type: "text"
value: " method is called with one argument, that argument will be available to the "
type: "inlineCode"
value: "next()"
type: "text"
value: " method being invoked.",type: "list"
spread: false
children:
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "done"
type: "text"
value: " (boolean)"
type: "list"
spread: false
children:
type: "listItem"
spread: true
children:
type: "paragraph"
summary: "As a couple of additions to ECMAScript 2015, Iteration protocols aren't new built-ins or syntax, but protocols. These protocols can be implemented by any object by following some conventions."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: ": "
type: "text"
value: "Has the value "
type: "inlineCode"
value: "false"
type: "text"
value: " if the iterator was able to produce the next value in the sequence. (This is equivalent to not specifying the "
type: "inlineCode"
value: "done"
type: "text"
value: " property altogether.)"
type: "paragraph"
summary: "As a couple of additions to ECMAScript 2015, Iteration protocols aren't new built-ins or syntax, but protocols. These protocols can be implemented by any object by following some conventions."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "Has the value "
type: "inlineCode"
value: "true"
type: "text"
value: " if the iterator has completed its sequence. In this case, "
type: "inlineCode"
value: "value"
type: "text"
value: " optionally specifies the return value of the iterator."
type: "listItem"
spread: false
children:
type: "paragraph"
children:
type: "inlineCode"
value: "value"
type: "list"
spread: false
children:
type: "listItem"
spread: true
children:
type: "paragraph"
children:
type: "text"
value: ": Any JavaScript value returned by the iterator. Can be omitted when "
type: "inlineCode"
value: "done"
type: "text"
value: " is "
type: "inlineCode"
value: "true"
type: "text"
value: ".",type: "paragraph"
summary: "As a couple of additions to ECMAScript 2015, Iteration protocols aren't new built-ins or syntax, but protocols. These protocols can be implemented by any object by following some conventions."
rowIndex: 1
shouldWrap: true
children:
type: "text"
value: "The "
type: "inlineCode"
value: "next()"
type: "text"
value: " method must always return an object with appropriate properties including "
type: "inlineCode"
value: "done"
type: "text"
value: " and "
type: "inlineCode"
value: "value"
type: "text"
value: ". If a non-object value gets returned (such as "
type: "inlineCode"
value: "false"
type: "text"
value: " or "
type: "inlineCode"
value: "undefined"
type: "text"
value: "), a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} ("
type: "inlineCode"
value: "\"iterator.next() returned a non-object value\""
type: "text"
value: ") will be thrown."
tr (61:3) => tableRow
type: "html"
value: "<td><p>A function, with either zero arguments or one argument, that returns an object with at least the following two properties. If the <code>next()</code> method is called with one argument, that argument will be available to the <code>next()</code> method being invoked.</p><dl><dt><code>done</code> (boolean)</dt><dd><p>Has the value <code>false</code> if the iterator was able to produce the next value in the sequence. (This is equivalent to not specifying the <code>done</code> property altogether.)</p><p>Has the value <code>true</code> if the iterator has completed its sequence. In this case, <code>value</code> optionally specifies the return value of the iterator.</p></dd><dt><code>value</code></dt><dd>Any JavaScript value returned by the iterator. Can be omitted when <code>done</code> is <code>true</code>.</dd></dl><p>The <code>next()</code> method must always return an object with appropriate properties including <code>done</code> and <code>value</code>. If a non-object value gets returned (such as <code>false</code> or <code>undefined</code>), a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} (<code>\"iterator.next() returned a non-object value\"</code>) will be thrown.</p></td>"
table.standard-table (53:1) => table
type: "html"
value: "<tr><td><code>next()</code></td><td><p>A function, with either zero arguments or one argument, that returns an object with at least the following two properties. If the <code>next()</code> method is called with one argument, that argument will be available to the <code>next()</code> method being invoked.</p><dl><dt><code>done</code> (boolean)</dt><dd><p>Has the value <code>false</code> if the iterator was able to produce the next value in the sequence. (This is equivalent to not specifying the <code>done</code> property altogether.)</p><p>Has the value <code>true</code> if the iterator has completed its sequence. In this case, <code>value</code> optionally specifies the return value of the iterator.</p></dd><dt><code>value</code></dt><dd>Any JavaScript value returned by the iterator. Can be omitted when <code>done</code> is <code>true</code>.</dd></dl><p>The <code>next()</code> method must always return an object with appropriate properties including <code>done</code> and <code>value</code>. If a non-object value gets returned (such as <code>false</code> or <code>undefined</code>), a {{anN4cmVmKCJUeXBlRXJyb3IiKQ==}} (<code>\"iterator.next() returned a non-object value\"</code>) will be thrown.</p></td></tr>"
type: "code"
lang: "plain"
meta: ""
value: "Evaluating the left side Evaluating the middle side Evaluating the right side 512 "
tr (133:9) => tableRow
type: "html"
value: "<td><pre class=\"brush: js\">function echo(name, num) {\n console.log(\"Evaluating the \" + name + \" side\");\n return num;\n}\n// Notice the exponentiation operator (**)\nconsole.log(echo(\"left\", 2) ** echo(\"middle\", 3) ** echo(\"right\", 2));\n</pre></td>",type: "html"
value: "<td><pre class=\"brush: plain\">Evaluating the left side\nEvaluating the middle side\nEvaluating the right side\n512\n</pre></td>"
td (154:13) => tableCell
type: "code"
lang: "js"
meta: ""
value: "function echo(name, num) { console.log(\"Evaluating the \" + name + \" side\"); return num; } // Notice the parentheses around the left and middle exponentiation console.log((echo(\"left\", 2) ** echo(\"middle\", 3)) ** echo(\"right\", 2));"
td (163:13) => tableCell
type: "code"
lang: "plain"
meta: ""
value: "Evaluating the left side Evaluating the middle side Evaluating the right side 64"
tr (153:9) => tableRow
type: "html"
value: "<td><pre class=\"brush: js\">function echo(name, num) {\n console.log(\"Evaluating the \" + name + \" side\");\n return num;\n}\n// Notice the parentheses around the left and middle exponentiation\nconsole.log((echo(\"left\", 2) ** echo(\"middle\", 3)) ** echo(\"right\", 2));</pre></td>",type: "html"
value: "<td><pre class=\"brush: plain\">Evaluating the left side\nEvaluating the middle side\nEvaluating the right side\n64</pre></td>"
table.standard-table (107:1) => table
type: "html"
value: "<tr><td>Code</td><td>Output</td></tr>",type: "html"
value: "<tr><td><pre class=\"brush: js\">function echo(name, num) {\n console.log(\"Evaluating the \" + name + \" side\");\n return num;\n}\n// Notice the division operator (/)\nconsole.log(echo(\"left\", 6) / echo(\"middle\", 2) / echo(\"right\", 3));\n</pre></td><td><pre class=\"brush: plain\">Evaluating the left side\nEvaluating the middle side\nEvaluating the right side\n1\n</pre></td></tr>",type: "html"
value: "<tr><td><pre class=\"brush: js\">function echo(name, num) {\n console.log(\"Evaluating the \" + name + \" side\");\n return num;\n}\n// Notice the exponentiation operator (**)\nconsole.log(echo(\"left\", 2) ** echo(\"middle\", 3) ** echo(\"right\", 2));\n</pre></td><td><pre class=\"brush: plain\">Evaluating the left side\nEvaluating the middle side\nEvaluating the right side\n512\n</pre></td></tr>",type: "html"
value: "<tr><td><pre class=\"brush: js\">function echo(name, num) {\n console.log(\"Evaluating the \" + name + \" side\");\n return num;\n}\n// Notice the parentheses around the left and middle exponentiation\nconsole.log((echo(\"left\", 2) ** echo(\"middle\", 3)) ** echo(\"right\", 2));</pre></td><td><pre class=\"brush: plain\">Evaluating the left side\nEvaluating the middle side\nEvaluating the right side\n64</pre></td></tr>"