BASELINE NowYouCanUse.com
Newly Available Regular expressions
id: regexp-escape

RegExp.escape()

The RegExp.escape() static method takes a string and replaces any characters that are potentially special characters of a regular expression with equivalent escape sequences. For example, RegExp.escape("[abc]") returns "\\[abc\\]".
Baseline Status: Achieved Newly Available on May 1, 2025 across core engines.
Desktop Browser Engine Support
Google Chrome
136
Supported
Mozilla Firefox
134
Supported
Apple Safari
18.2
Supported
Microsoft Edge
136
Supported
Mobile Browser Engine Support
Chrome Android
136
Firefox Android
134
Safari iOS
18.2
Specifications and References