PHP escaped regular expression character: Preg_quote
Preg_quote-escaping regular expression characters
String Preg_quote (String $str [, String $delimiter = NULL])
Preg_quote () requires the parameter str and adds a backslash to the character in each of the regular expression syntax. This is typically used when you have some run-time strings that need to be matched as regular expressions.
The regular expression special characters are:. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -
Parameters
-
Str
-
Input string
-
Delimiter
-
If an optional parameter delimiter is specified, it is also escaped. This is typically used to escape the delimiter used by the Pcre function. /is the most common delimiter.
return value
Returns the escaped string.
Preg_quote () example
$keywords = ' $ g3/400 for a ';
$keywords = Preg_quote ($keywords, '/');
Echo $keywords; Returns \$40 for a g3\/400
?>
http://www.bkjia.com/PHPjc/951492.html www.bkjia.com true http://www.bkjia.com/PHPjc/951492.html techarticle PHP escaped regular expression character: Preg_quote Preg_quote escaped the regular expression character string preg_quote (string $str [, String $delimiter = NULL]) preg_qu OTE () requires the parameter str and ...