RegExp.escape()

C. Scott Ananian ecmascript at cscott.net
Mon Jun 29 18:42:14 UTC 2015


Please, not an iterable over characters.  (Or at least, "not only".) Use a
RegExp.  Imagine trying to ensure that any characters over \u007f were
escaped.  You don't want an iterable over ~64k characters.

In addition, a RegExp would allow you to concisely specify "hex digits, but
only at the start of the string" and some of the other oddities we've
considered.
  --scott
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150629/b091679e/attachment.html>


More information about the es-discuss mailing list