Regex.escapeString

Escapes the special characters used for regular expressions in string, for instance "a.b*c" becomes "a\.b\*c". This function is useful to dynamically generate regular expressions. string can contain nul characters that are replaced with "\0", in this case remember to specify the correct length of string in length. Since 2.14

class Regex
static
string
escapeString
(
string string
,
int length
)

Parameters

string string

the string to escape. [array length=length]

length int

the length of string, or -1 if string is nul-terminated

Return Value

Type: string

a newly-allocated escaped string

Meta