Re: Remove Dynamic String between StringA and StringB
| From: | memoimyself at yahoo dot com dot br | Date: | Tue, 27 Jan 2004 14:26:24 +0000 |
| Subject: | Re: Remove Dynamic String between StringA and StringB | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175910@lists.php.net to get a copy of this message | ||
On 27 Jan 2004 at 13:25, Jack Bauer wrote:
> 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.
Of course. "\w*" will match alphanumeric characters, but not whitespace, and word
boundaries are typically whitespace.
> i really tried to use the php manual and google to find some help for
> this, but i got no luck with that :(
It's not a question of luck; it's a question of investing a little of your time in reading
and
learning. You don't want to spend your time doing that but expect other people to spend
theirs providing you with all the answers you need. You've been given a few pointers
(such as the online introductory guide to regular expressions, which will tell you
everything about matching word characters, non-word characters etc etc) but don't
seem to have taken any interest in them, because of course that would mean you'd
have to actually spend an hour or so of your valuable time doing some reading. Bear in
mind that other people's time is *also* valuable.
> i think it have to do something with the \w in the pattern,
> is there a parameter to resolve my problem too?
Go to http://msdn.microsoft.com/library/en-
us/script56/html/js56reconIntroductionToRegularExpressions.asp and read it, especially
the Regular Expression Syntax section. After doing that, read the relevant part of the
PHP manual. Things will start to make sense soon enough.
Erik