* Thus wrote Eli Gordon ([EMAIL PROTECTED]):
> 
> According to this doc:
>    : if you want to match a backslash, you write "\\".
> 
> This does not seem to be the case. In fact, you need three backslashes
> ("\\\"), not just two.
> 

The context that the statement is used is describing syntax for
PCRE usage not php.

> For example, let's say we want to replace all instances of "\b" in the
> string "foo \b" with the word "bar":
> 
> preg_replace('/\\b/', 'bar', 'foo \b');
> returns: "barfoobar \barbbar"

php passes '\b' to pcre, which treats that as a word boundry.
the 'foo \b' is untouched.

> 
> preg_replace('/\\\b/', 'bar', 'foo \b');
> returns what we expect: "foo bar"

php passes '\\b' to pcre, and does what is defined in the section
you pointed out. 'foo \b' remains untouched.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

Reply via email to