Robin Vickery wrote:
Both of these will fail to compile:
preg_match( '/\\7abc/', $myString);
preg_match( '/\7abc/', $myString);
Both of these are fine:
preg_match( '/\\abc7/', $myString);
preg_match( '/\abc7/', $myString);
In fact they behave *exactly* as if you hadn't doubled them up. You've
not achieved anything, but you've made your regexp just a little more
difficult to read and maintain.
You achieved something. You made your code syntactically correct, even
if PHP lets you get away with things like \a inside single-quoted strings.
\\ always works
\ only works sometimes, depending on what character follows it.
No it doesn't. Indiscriminately doubling up all your back-slashes is
not an alternative to actually learning the proper syntax.
The proper syntax is to double the backslash, not to rely on the fact
that the character following it happens to not make it a special character.
Jasper
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php