$term = preg_replace('/(\\)/', 'backslash $1', $term);
causes an error** while using three backslashes (see 2.) works.
2.1. $term = "beg \ end"; print preg_replace('/(\\\)/', 'backslash $1', $term); returns: beg backslash \ end
2.2. $term = "beg \\ end"; print preg_replace('/(\\\)/', 'backslash $1', $term); returns: beg backslash \ end (the same as 2.1.)
2.3. $term = "beg \\\ end"; print preg_replace('/(\\\)/', 'backslash $1', $term); returns: beg backslash \backslash \ end
Does this make ANY sense?
- jns
* http://www.php.net/manual/en/pcre.pattern.syntax.php
** "Warning: Compilation failed: missing ) at offset 3 in /home/jonas/public_html/test01.php on line 3"
Am Mittwoch, 01.10.03 um 19:14 Uhr schrieb CPT John W. Holmes:
Regular expressions are for "pattern matching"... not matching everything
BUT a pattern.
good point! ;)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php