regexEscapeString

fun regexEscapeString(string: String, length: Int): String

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.

Return

a newly-allocated escaped string

Since

2.14

Parameters

string

the string to escape

length

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