RE: [PHP] Regular expressions
| From: | Chrome | Date: | Mon, 16 Oct 2006 21:19:20 +0000 |
| Subject: | RE: [PHP] Regular expressions | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243226@lists.php.net to get a copy of this message | ||
>On 10/16/06, Chrome <admin@chrome.me.uk> wrote:
>> [snip]
>> ? means "maybe" in some other place in PCRE. Or maybe that's POSIX.
>> Never have figured that one out.
>> [/snip]
>>
>> ? directly after an expression is equivalent to {0,1} (maybe) but
>> after a quantifier (*, +, {}) means ungreedy
>
>I kind of talked about this in the reply to richard the .*? is exactly
>the same as doing .*(?U)
>
>an inline modifier to the previous expression.
>
>That makes me wonder.. according to the docs U inverts greediness, if
>you have...
>/foo.*?bar/U
>
>does that make .*? a greedy .*
>
>Curt.
Good point... I suppose it would... I'm not au fait with greediness in
honesty... I just remember the syntax
Strange really because I'm arguing with a regex at the minute lol
Dan
--
http://chrome.me.uk