Re: preg_match
| From: | John Nichel | Date: | Sat, 20 Aug 2005 12:00:35 +0000 |
| Subject: | Re: preg_match | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221004@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
On Fri, August 19, 2005 7:03 am, Matthew Weier O'Phinney wrote:Personally, I have never used \\ in PCRE when looking for things like spaces (\s), word boundraries (\b), etc. and it's all worked out fine. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com* John Nichel <john@kegworks.com> :But Perl isn't going to *SEE* \\s !!! PHP is going to *EAT* \\ and make \ out of it. That's why \ is an escape character in PHP. It's also an escape character in Perl/PCRE. Some days I think PHP's escape character should have been | or something, just so this topic wouldn't come up every damn month. <snip>Richard Lynch wrote:On Thu, August 18, 2005 2:50 pm, Jon wrote:anypreg_match_all("/Charges \s\s+ $total x (.+) /siU", $single, $from_invoice);I would recommend using \\s instead of \s -- While \s doesn't havemeaning in PHP strings, so PHP just figures you must have meant\\s <snip> But in perl type regex's, the \s is a space. Without testing it, I don't think \\s would match what the OP was looking for (I *think*