View Single Post
Old 03-28-2008, 02:22 AM   #1 (permalink)
arcticfire
The Visitor
Newcomer 
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
arcticfire is on a distinguished road
Default Need Regular Expressions Help

Hey all. First post. Anyway, I've been working on this for quite a while with two other people and we just can't figure it out.

We're trying to use regexp to remove the span tags from the following bit of html code. The outcome will be that users to our IPB forum will be able to turn off colors if they want.

Here is an example post.
HTML Code:
Regular text<br><br><!--coloro:#FF0000--><span style="color: rgb(255, 0, 0);"><!--/coloro-->Colored Text<!--colorc--></span><!--/colorc--> and more <!--coloro:#0000FF--><span style="color: rgb(0, 0, 255);"><!--/coloro-->Colored Text<!--colorc--></span><!--/colorc--><br><br>Some <img src="style_emoticons/default/laugh.gif" style="vertical-align: middle;" emoid=":lol:" alt="laugh.gif" border="0"> Cool  <img src="style_emoticons/default/wink.gif" style="vertical-align: middle;" emoid=";)" alt="wink.gif" border="0"> Smilies <img src="style_emoticons/default/unsure.gif" style="vertical-align: middle;" emoid=":unsure:" alt="unsure.gif" border="0"> <br><br><!--sizeo:6--><span style="font-size: 24pt; line-height: 100%;"><!--/sizeo-->Bigger<!--sizec--></span><!--/sizec--><br><br><!--fonto:Impact--><span style="font-family: Impact;"><!--/fonto-->Different<!--fontc--></span>
Using regular expressions, we hope to take the code off of this:
HTML Code:
<!--coloro:#FF0000--><span style="color: rgb(255, 0, 0);"><!--/coloro-->Colored Text<!--colorc--></span><!--/colorc--> and more <!--coloro:#0000FF--><span style="color: rgb(0, 0, 255);"><!--/coloro-->Colored Text<!--colorc--></span><!--/colorc-->
to make it this:
HTML Code:
Colored Text and more Colored text
Basically, we need the right regex to remove all between the <!--coloro:a.color.here--><!--/coloro--> and <!--colorc--><!--/colorc> tags.

Can anybody help?
arcticfire is offline  
Reply With Quote