This must have been suggested before, but it would be great to have a built-in
function for quoting text in a RegExp.
For example:
```js
RegExp.quoteText = function (text) {
return text.replace(/[\^\$\\.*+?()[\]{}|]/g, '\\\$&');
};
```
If you wanted to be extra thorough, you could include parens, braces and
brackets.
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss