PCRE regex result is different between Linux & Windows.
| From: | ClapClap | Date: | Fri, 07 Nov 2008 18:13:02 +0000 |
| Subject: | PCRE regex result is different between Linux & Windows. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283082@lists.php.net to get a copy of this message | ||
Hi,
[I precede you, sorry for language mistakes...]
I have done a pretty regex which can normally strip all the empties HTML tags. With PHP v5.2.4, under Windows XP, preg_replace() gives me 90 matches (which is correct) while under linux it stagnate to 54.
Let me introduce this regex :
$pattern = '
@
<([a-z0-9]+)[^>]*> # open tag(?:[\s|(?: )]*| # white characters (ugly ?)
(?R))* # recursion (parent tag is empty to ?) </\s*\1\s*> # close tag@Sux'; // I love those pattern's options !! :-D) So, is it normal that I have this big difference for matches (Windows vs Linux) ? I thought it was a recursion trouble so I include the preg_replace() in a do/while structure. It did not change anything... If anyone can tell me about it, it will be a pleasure ! -- Julien