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
Copy file name to clipboardExpand all lines: spec.emu
+2-6Lines changed: 2 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -43,16 +43,12 @@ contributors: Jordan Harband
43
43
<h1>RegExp.escape ( _S_ )</h1>
44
44
<p>This method takes a string and returns a similar string in which each character that is potentially special in a regular expression |Pattern| has been replaced by an escape sequence representing that character.</p>
45
45
<p>It performs the following steps when called:</p>
46
-
<p>
47
-
The phrase "<dfn id="the ASCII punctuators that need escaping">the ASCII punctuators that need escaping</dfn>"
48
-
denotes the following String, which consists of every ASCII punctuator except U+005F (LOW LINE):
49
-
*"(){}[]|,.?\*+-^$=<>\/#&!%:;@~'"`"*.
50
-
</p>
51
46
52
47
<emu-alg>
53
48
1. Let _str_ be ? ToString(_S_).
54
49
1. Let _cpList_ be StringToCodePoints(_str_).
55
-
1. Let _toEscape_ be StringToCodePoints(the ASCII punctuators that need escaping).
50
+
1. Let _punctuators_ be the following String, which consists of every ASCII punctuator except U+005F (LOW LINE): *"(){}[]|,.?\*+-^$=<>\/#&!%:;@~'"`"*.
51
+
1. Let _toEscape_ be StringToCodePoints(_punctuators_).
56
52
1. Let _escapedList_ be a new empty List.
57
53
1. For each code point _c_ in _cpList_, do
58
54
1. If _escapedList_ is empty and _c_ is matched by |DecimalDigit|, then
0 commit comments