Re (2) rdude at fuzzelfish dot com:
In case anyone else missed it, you do NOT have to use / as your preg escape character. You can use any two matching characters.
![]() | preg_quote说明string preg_quote ( string str [, string delimiter] )preg_quote() 以 str 为参数并给其中每个属于正则表达式语法的字符前面加上一个反斜线。如果你需要以动态生成的字符串作为模式去匹配则可以用此函数转义其中可能包含的特殊字符。 如果提供了可选参数 delimiter,该字符也将被转义。可以用来转义 PCRE 函数所需要的定界符,最常用的定界符是斜线 /。 正则表达式的特殊字符包括:. \\ + * ? [ ^ ] $ ( ) { } = ! < > | :。
![]()
php dot net at sharpdreams dot com
25-Jul-2005 10:34
Re (2) rdude at fuzzelfish dot com:
me@localhost
30-Mar-2005 02:51
Re rdude at fuzzelfish dot com:
rdude at fuzzelfish dot com
17-Feb-2005 12:35
Another character that preg_quote will not escape is the all important "/" character. You will need to convert "/" into "\/" yourself. For example, this code does not work:
mina86 at tlen dot pl
26-Dec-2003 07:02
Re: adrian holovaty
adrian holovaty
16-Jul-2003 08:12
Note that if you've used the "x" pattern modifier in your regex, you'll want to make sure you escape any whitespace in your string that you *want* the pattern to match. | ![]() | ||