Re: Regular Expression differences between 4.4 and 5.2
| From: | Ewen Cumming | Date: | Fri, 12 Sep 2008 12:41:42 +0000 |
| Subject: | Re: Regular Expression differences between 4.4 and 5.2 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-279965@lists.php.net to get a copy of this message | ||
Actually bummer - testing on wrong version.
The U modifier is causing problems too - only matching the first character
instead of the whole string.
2008/9/12 Ewen Cumming <ewen.cumming@gmail.com>
> Hi Jochem,
>
> Replacing the 's' modifier with 'm' fixed it this instance but broke other
> parts on the site (the same result as removing 's').
>
> But the other regex ( $pattern = "/<!T_([^>
> ]+)([^>]*)>(.*?)<!T_end\\1>|<!T_([^>
> ]+)([^>]*)>/Ui";) is working perfectly.
>
> I will continue to test and see if it throws up any other problems. Many
> thanks for such a quick and great response.
>
> I will file a bug report however I may need to submit the full test string
> as cutting it down any further seems to 'fix' the discrepency.
>
> Thanks again,
> Ewen
>
>
>
> 2008/9/12 Jochem Maas <jochem@iamjochem.com>
>
> Jochem Maas schreef:
>>
>>> Ewen Cumming schreef:
>>>
>>>> Hi everybody,
>>>>
>>>>
>>> ...
>>
>>
>>> BUT I may have work around for you, try this regexp (replaces s modifer
>>> with m modifier):
>>>
>>> $pattern = "/<!T_([^> ]+)([^>]*)>(.*?)<!T_end\\1>|<!T_([^>
>>> ]+)([^>]*)>/mi";
>>>
>>>
>> the following pattern also seems to do what you want:
>>
>> $pattern = "/<!T_([^> ]+)([^>]*)>(.*?)<!T_end\\1>|<!T_([^>
>> ]+)([^>]*)>/Ui";
>>
>>
>> Im interested to know if either of these two solve your immediate issue.
>>
>
>