PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, May 09, 2001 1:46 PM
Subject: Re: [PHP] Search a string between foo/foo
On Wednesday 09 May 2001 16:14, Luiz Vitor wrote:
It's still not working.
I'm using the pattern ([^foo]*) and I'm getting the first match
correct, but it's not getting all
Hi...
I have a text and, some words of the text have the tags url/url between them.
What i'm trying to do is to replace the word between that tags for a url, wich I'll
search them in a database and convert to a url.
It's working fine when I have only one url/url, but when there are more than
The problem is that it matches the first foo with the first /foo and the
second foo witht eh /foo ( andmatches those properly) but it also matches
the first foo with the second /foo (thisnk of the logic of the regex).
What you need to do is rather than specify any character (.*) specify any
.* in your patten will match everything It's greedy like perl (unless you
compiled php not to be)
add a ? and it will make it none greedy
^[foo]* will not work ^ needs to be in [] to mean not else it means
start of string
Luiz Vitor [EMAIL PROTECTED] wrote in message
Subject: Re: [PHP] Search a string between foo/foo
.* in your patten will match everything It's greedy like perl (unless
you
compiled php not to be)
add a ? and it will make it none greedy
^[foo]* will not work ^ needs to be in [] to mean not else it means
start of string
Luiz Vitor
2001 15:14
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Search a string between foo/foo
It's still not working.
I'm using the pattern ([^foo]*) and I'm getting the first match correct,
but it's not getting all the other matches.
Thanks,
Luiz Vitor
- Original Message -
From: Toby Dacre
On Wednesday 09 May 2001 16:14, Luiz Vitor wrote:
It's still not working.
I'm using the pattern ([^foo]*) and I'm getting the first match
correct, but it's not getting all the other matches.
[^foo] means any character except '', 'f', 'o' and ''
You're looking for something like this:
$Text
7 matches
Mail list logo