Tom: Kommando zurück. Greedyness mit U oder ?

Beitrag lesen

Hello,

Er war an den entscheidenen Stellen nicht gierig genug.

oder doch besser anders herum? Ich sag ja, geht das nicht anders?

http://de.php.net/manual/en/regexp.reference.php

However, if a quantifier is followed by a question mark, then it ceases to be greedy, and instead matches the minimum number of times possible, so the pattern /\.*?\/  does the right thing with the C comments. The meaning of the various quantifiers is not otherwise changed, just the preferred number of matches. Do not confuse this use of question mark with its use as a quantifier in its own right. Because it has two uses, it can sometimes appear doubled, as in \d??\d  which matches one digit by preference, but can match two if that is the only way the rest of the pattern matches.

Ich hätte den Modifier U benutzt
http://de.php.net/manual/en/reference.pcre.pattern.modifiers.php

DANN macht das ? den Quantifier gierig...

*tztz*

Liebe Grüße aus dem schönen Oberharz

Tom vom Berg

--
Nur selber lernen macht schlau
http://bergpost.annerschbarrich.de