>>Remove Dynamic String between StringA and StringB

From: Date: Tue, 27 Jan 2004 12:25:27 +0000
Subject: >>Remove Dynamic String between StringA and StringB
Groups: php.general 
Request: Send a blank email to php-general+get-175892@lists.php.net to get a copy of this message
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

« previous php.general (#175892) next »