Skip to content

Commit

Permalink
Deploying to gh-pages from @ cf7270b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 28, 2023
1 parent 650b6f5 commit 552824b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,7 @@
</ul></div><div id="menu-toggle"><svg xmlns="http://www.w3.org/2000/svg" style="width:100%; height:100%; stroke:currentColor" viewBox="0 0 120 120">
<title>Menu</title>
<path stroke-width="10" stroke-linecap="round" d="M30,60 h60 M30,30 m0,5 h60 M30,90 m0,-5 h60"></path>
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-text-processing" title="Text Processing"><span class="secnum">22</span> Text Processing</a><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-regexp-regular-expression-objects" title="RegExp (Regular Expression) Objects"><span class="secnum">22.2</span> RegExp (Regular Expression) Objects</a><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-regexp-constructor" title="Properties of the RegExp Constructor"><span class="secnum">22.2.5</span> Properties of the RegExp Constructor</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-regexp.escape" title="RegExp.escape ( S )"><span class="secnum">22.2.5.2</span> RegExp.escape ( <var>S</var> )</a></li></ol></li></ol></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 2 Draft / September 26, 2023</h1><h1 class="title">RegExp.escape</h1>
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-text-processing" title="Text Processing"><span class="secnum">22</span> Text Processing</a><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-regexp-regular-expression-objects" title="RegExp (Regular Expression) Objects"><span class="secnum">22.2</span> RegExp (Regular Expression) Objects</a><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-properties-of-the-regexp-constructor" title="Properties of the RegExp Constructor"><span class="secnum">22.2.5</span> Properties of the RegExp Constructor</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-regexp.escape" title="RegExp.escape ( S )"><span class="secnum">22.2.5.2</span> RegExp.escape ( <var>S</var> )</a></li></ol></li></ol></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="version">Stage 2 Draft / September 28, 2023</h1><h1 class="title">RegExp.escape</h1>
<emu-clause id="sec-text-processing" number="22">
<h1><span class="secnum">22</span> Text Processing</h1>
Expand All @@ -2718,7 +2718,7 @@ <h1><span class="secnum">22.2.5.2</span> RegExp.escape ( <var>S</var> )</h1>
<emu-val>"(){}[]|,.?*+-^$=&lt;&gt;\/#&amp;!%:;@~'"`"</emu-val>.
</p>
<emu-alg><ol><li>Let <var>str</var> be ?&nbsp;<emu-xref aoid="ToString"><a href="https://tc39.es/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>S</var>).</li><li>Let <var>cpList</var> be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> containing in order the code points as defined in 6.1.4 of <var>str</var>, starting at the first element of <var>str</var>.</li><li>Let <var>toEscape</var> be a <emu-xref href="#pattern-charset"><a href="https://tc39.es/ecma262/#pattern-charset">CharSet</a></emu-xref> containing every character in <emu-xref href="#the ASCII punctuators that need escaping" id="_ref_0"><a href="#the ASCII punctuators that need escaping">the ASCII punctuators that need escaping</a></emu-xref>.</li><li>Let <var>cuList</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each code point <var>c</var> in <var>cpList</var>, do<ol><li>If <var>c</var> is the first code point in <var>cpList</var> and <var>c</var> is a DecimalDigit, then<ol><li>Append code unit 0x005C (REVERSE SOLIDUS) to cuList.</li><li>Append code unit 0x0078 (LATIN SMALL LETTER X) to cuList.</li></ol></li><li>Else if <var>c</var> is a <emu-xref href="#sec-pattern-notation"><a href="https://tc39.es/ecma262/#sec-pattern-notation">CharSetElement</a></emu-xref> of <var>toEscape</var> or is WhiteSpace, then<ol><li>Append code unit 0x005C (REVERSE SOLIDUS) to cuList.</li></ol></li><li>Append the elements of the UTF16Encoding (10.1.1) of c to cuList.</li></ol></li><li>Return <emu-xref aoid="CodePointsToString"><a href="https://tc39.es/ecma262/#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>cuList</var>).</li></ol></emu-alg>
<emu-alg><ol><li>Let <var>str</var> be ?&nbsp;<emu-xref aoid="ToString"><a href="https://tc39.es/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>S</var>).</li><li>Let <var>cpList</var> be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> containing in order the code points as defined in 6.1.4 of <var>str</var>, starting at the first element of <var>str</var>.</li><li>Let <var>toEscape</var> be a <emu-xref href="#pattern-charset"><a href="https://tc39.es/ecma262/#pattern-charset">CharSet</a></emu-xref> containing every character in <emu-xref href="#the ASCII punctuators that need escaping" id="_ref_0"><a href="#the ASCII punctuators that need escaping">the ASCII punctuators that need escaping</a></emu-xref>.</li><li>Let <var>escapedList</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each code point <var>c</var> in <var>cpList</var>, do<ol><li>If <var>escapedList</var> is empty and <var>c</var> is a <emu-nt><a href="https://tc39.es/ecma262/#prod-DecimalDigit">DecimalDigit</a></emu-nt>, then<ol><li>Append code unit U+005C (REVERSE SOLIDUS) to <var>escapedList</var>.</li><li>Append code unit U+0078 (LATIN SMALL LETTER X) to <var>escapedList</var>.</li></ol></li><li>Else if <var>c</var> is a <emu-xref href="#sec-pattern-notation"><a href="https://tc39.es/ecma262/#sec-pattern-notation">CharSetElement</a></emu-xref> of <var>toEscape</var> or is <emu-nt><a href="https://tc39.es/ecma262/#prod-WhiteSpace">WhiteSpace</a></emu-nt>, then<ol><li>Append code unit U+005C (REVERSE SOLIDUS) to <var>escapedList</var>.</li></ol></li><li>Append the elements of <emu-xref aoid="UTF16EncodeCodePoint"><a href="https://tc39.es/ecma262/#sec-utf16encodecodepoint">UTF16EncodeCodePoint</a></emu-xref>(<var>c</var>) to <var>escapedList</var>.</li></ol></li><li>Return <emu-xref aoid="CodePointsToString"><a href="https://tc39.es/ecma262/#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>escapedList</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p><code>escape</code> takes a string and escapes it so it can be literally represented as a pattern. In contrast <emu-xref aoid="EscapeRegExpPattern"><a href="https://tc39.es/ecma262/#sec-escaperegexppattern">EscapeRegExpPattern</a></emu-xref> (as the name implies) takes a pattern and escapes it so that it can be represented as a string. While the two are related, they do not share the same character escape set or perform similar actions.</p>
Expand Down

0 comments on commit 552824b

Please sign in to comment.