.*? -> matches everything between $stringA and $stringB the "?" means: stop matching after the first occurence of $stringB (quantifier minimizer). otherwise ".*" would match everything between the first occurence of $stringA and the last occurence of $stringB
-> http://ch2.php.net/manual/de/pcre.pattern.syntax.php
g. tinu
Tue, 27 Jan 2004 13:25:27 +0100 Jack Bauer <[EMAIL PROTECTED]>:
Hi :),
i tried your code zu replace some parts of a string, the problem is that this method only replaces when there is only 1 word between stringA and stringB. i got the problem that the part between both strings is a dynamic one and much larger then 1 word. i really tried to use the php manual and google to find some help for this, but i got no luck with that :(
$stringA = "AA"; $stringB = "BB"; $string = "AA oneword BB AA two words BB";
$pattern = "/$stringA.\w*.$stringB/"; $replacement = ""; echo preg_replace($pattern, $replacement, $string);
i think it have to do something with the \w in the pattern, is there a parameter to resolve my problem too?
regards manuel
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php