Computes a new version of a String value in which certain characters have been escaped, so that the regular expression engine will interpret any metacharacters that it may contain as character literals.
When the escape function is called with one argument string, the following steps are taken:
- Let string be ToString(string).
- ReturnIfAbrupt(string).
- Let length be the number of characters in string.
- Let R be the empty string.