The Geek
11-13-2005, 08:38 PM
HowdA All,
I am hoping one of your gurus can help we out with a small regex problem.
What I want to do is find all occurrences of "my test" in the following string:
$text = "my test<ul><li>my test</li></ul> <b>my test</b> my test <i>my test</i> <!--nope--> my test";
Easy huh? However the real catch is that I want to find ALL of them EXCEPT <!--nope--> my test
So this is what im doing now:
#(\b((\s|<li>|<strong>|<b>|<i>)my test)s?\b)#im
Which catches all of them. How can I do it so it explicity DOESNT catch the last one?
Thanks all!
I am hoping one of your gurus can help we out with a small regex problem.
What I want to do is find all occurrences of "my test" in the following string:
$text = "my test<ul><li>my test</li></ul> <b>my test</b> my test <i>my test</i> <!--nope--> my test";
Easy huh? However the real catch is that I want to find ALL of them EXCEPT <!--nope--> my test
So this is what im doing now:
#(\b((\s|<li>|<strong>|<b>|<i>)my test)s?\b)#im
Which catches all of them. How can I do it so it explicity DOESNT catch the last one?
Thanks all!