From:             matthewb at syrah dot us
Operating system: Irrelevant
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  preg ungreedy modifier documentation unclear

Description:
------------
The preg documentation for setting the ungreedy modifier in the middle of
a pattern is unclear on this page:

http://www.php.net/manual/en/pcre.pattern.modifiers.php

In the "U (PCRE_UNGREEDY)" section it says: 

"It [the ungreedy modifier] can also be set by a (?U) modifier setting
within the pattern."

This is confusing.  Why is the "U" inside the parentheses?  Why are the
parentheses even here?  As far as I can tell, neither the parentheses nor
the U have anything to do with using "?" to make a particular quantifier
ungreedy within a pattern.  Specifically, neither /,.*?U,/ nor /,.*(?U),/
seem to make the * ungreedy.

In my opinion, it would be more clear to say:

"The ungreedy modifier can also be applied to individual quantifiers
within a pattern by placing a "?" after the quantifier. For example
/,.*?,/ will ungreedily match characters between the commas."

(Aside: I admit that the effects of the "?" inside patterns is well
documented on this page:

http://www.php.net/manual/en/pcre.pattern.syntax.php

But unfortunately the word "ungreedy", while it does appear on the page,
does not appear near the section describing the ungreedy effects of "?".)

Many thanks.


-- 
Edit bug report at http://bugs.php.net/?id=24571&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24571&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24571&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24571&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24571&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24571&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24571&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24571&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24571&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24571&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24571&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24571&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24571&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24571&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24571&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24571&r=gnused


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to