Arpad Ray wrote:
> Jochem Maas wrote:
>> Arpad Ray wrote:
>>> return preg_replace('#%5[bd](?=[^&]*=)#ei', 'urldecode("\0")', $s);
>>>
>> could you explain your regexp - I'd like to replace my version with
>> your (if for no other reason than that shorter code is easier to read
>> than
>> longer code!) BUT until I really understand your regexp I'd feel 100%
>> comfortable
>> making the replacement.
>>
> Basically, if we find a '=' before a '&' then we know we're in the key.
> The (?=) is a positive assertion, which says that the bracket must be
ah yes - the look ahead assertion was throwing me.
> followed by a '=', optionally with any characters except '&' in between.
> Here's the pattern with comments:
>
> ~
> %5[bd] # the bracket
> (?= # must be followed by
> [^&]* # any characters except "&"
> = # then a "="
> )
> ~eix
>
thanks very much for the explanation!
> Regards,
>
> Arpad
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php