Skip to content

Commit

Permalink
Deploying to gh-pages from @ 03e29a5 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 19, 2023
1 parent 3000c87 commit 80828eb
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-none"></span><a href="#sec-patterns" title="Patterns"><span class="secnum">22.2.1</span> Patterns</a></li><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 / October 12, 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-none"></span><a href="#sec-patterns" title="Patterns"><span class="secnum">22.2.1</span> Patterns</a></li><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 / October 19, 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 Down Expand Up @@ -2766,7 +2766,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 <emu-xref aoid="StringToCodePoints"><a href="https://tc39.es/ecma262/#sec-stringtocodepoints">StringToCodePoints</a></emu-xref>(<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 matched by <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><li>Append code unit U+0033 (DIGIT THREE) to <var>escapedList</var>.</li></ol></li><li>Else if <var>toEscape</var> contains <var>c</var> or <var>c</var> is matched by <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-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 <emu-xref aoid="StringToCodePoints"><a href="https://tc39.es/ecma262/#sec-stringtocodepoints">StringToCodePoints</a></emu-xref>(<var>str</var>).</li><li>Let <var>toEscape</var> be <emu-xref aoid="StringToCodePoints"><a href="https://tc39.es/ecma262/#sec-stringtocodepoints">StringToCodePoints</a></emu-xref>(<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 matched by <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><li>Append code unit U+0033 (DIGIT THREE) to <var>escapedList</var>.</li></ol></li><li>Else if <var>toEscape</var> contains <var>c</var> or <var>c</var> is matched by <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 80828eb

Please sign in to comment.