Regex.escapeString

string escapeString(string string_)

Escapes the special characters used for regular expressions in string, for instance "a.bc" 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.

Parameters

string_the string to escape

Returns

a newly-allocated escaped string