Thread: help w/ a regex

    #1
  1. film at 11
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    413
    Rep Power
    15
    I want a regular expression that matches any html tag that isn't an opening or closing bold or italics tag. Here are some regular expressions i have tried:

    "<[/]?[^bi]+>"
    "<[/]?[^bi]+(b|i)[^bi]+>"

    any input is appreciated. thanks,
    nick
  2. #2
  3. film at 11
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Portland, OR
    Posts
    413
    Rep Power
    15
    nevermind

    for anybody curious,
    you're crazy. but here's my solution:

    eregi("</?[^bi/]+[^bi>]*", $str) &#0124; &#0124;
    eregi("</?(b|i)[^>]+", $str) &#0124; &#0124;
    eregi("</?(//)+", $str)

    will catch all tags in $str that aren't opening or closing bold/italics tags (i think)

Similar Threads

  1. compile php to use system regex and apache2
    By edman007 in forum PHP Development
    Replies: 0
    Last Post: November 7th, 2003, 08:11 PM
  2. improve my regex
    By JunkCookie in forum Perl Programming
    Replies: 7
    Last Post: September 29th, 2003, 01:52 PM
  3. Need help on regex?
    By trendmatrix in forum HTML Programming
    Replies: 1
    Last Post: August 2nd, 2003, 05:54 PM
  4. Replies: 1
    Last Post: October 30th, 2001, 12:42 PM
  5. which regex approach is best
    By bumperbox in forum Perl Programming
    Replies: 3
    Last Post: August 30th, 2001, 06:05 PM

IMN logo majestic logo threadwatch logo seochat tools logo