escapeRegExp
Modified on Mon, 31 Jul 2023
Description
Escape the RegExp special characters ('^', '$', '\', '.', '*', '+', '?', '(', ')', '[', ']', '{', '}', and '|') in string
Syntax
escapeRegExp(text)
Parameters
| Input Parameter | Type | Description |
|---|---|---|
| text | string | The string to escape. |
Return value
| Type |
|---|
| string |
Sample
| Example | Result | Description |
|---|---|---|
| escapeRegExp('[A-Z]') | '\[A-Z\]' | Escape regular expression special characters |
To view all the String functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article