Using Regular Expressions

Results 1 to 2 of 2

Thread: Using Regular Expressions

  1. #1
    Join Date
    Dec 1969

    Default Using Regular Expressions

    I am stripping html tags from text I am pulling, used the FAQs for that one, the problem is that I want to keep a couple of tags ex. <b></b>. I am currently using the following syntax: "<[^>,p>]+>" but that keeps all tags that have a p in them. Like <td valign="top">, how can I restrict the comparison? Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Using Regular Expressions

    Yuck.<BR><BR>"&#060;[^&#062;,p]+&#062;" means a "&#060;", followed by any character except "&#062;", ",", and "p", any number of times (but more than once).<BR><BR>I assume you&#039;re doing something along the lines of:<BR>"Replace (above expression) with blank"<BR><BR>Ok.<BR><BR>What you want to say is: Strip all HTML tags which have a "&#060;", followed by anything other than "p", "b", or "i" (for example).<BR><BR>"&#060;[s]*[^&#062;p,bi]+&#062;"<BR><BR>That says: a "&#060;" character, any amount of whitespace (bloody WYSIWYG editors), and then anything BUT a "&#062;", a comma, a "p", a "b", or an "i", followed by a "&#062;".<BR><BR>I think.<BR><BR>RegExps are a bit rusty though.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts