Forum Moderators: coopster

Message Too Old, No Replies

One last preg replace request

Full tags

         

wesg

4:08 am on Aug 9, 2008 (gmt 0)

10+ Year Member



I hope this is the last request in my ongoing regex saga.

I have a system that does what I want. I can replace tags while leaving the inside text alone. THe trouble arises when I try to replace tags that are surrounding other tags. This is because my expression does not allow other brackets to be part of the wildcard.

IE. My current expression is

#<strong>([^<]+)</strong>#

which would work if the string is

<strong>Hello world</strong>

but not when the string is

<strong><em>Hello world</em></strong>.

How can I add text so that the expression allows other tags to pass through, but stop at the closing tag?

ColinPL

5:15 pm on Aug 11, 2008 (gmt 0)

10+ Year Member



#<strong>(.*?)</strong>#