SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to exempt html tags from regular expressions?

    hi, I'm having a little trouble figuring out how to basically exempt html code from regular expressions. I have a search function on my site that searches through a mysql table and outputs the results with the search word in bold. The problem is that if the search word is located between link tags for example, the bold tags will break the link. Also, if someone searches for the letter b for instance, when everything is outputted to the browser all <br> tags are broken.

    So, basically, how do you go about using ereg_replace only on text that is not between < and > and that is not between <a href...> and </a>

    thanks in advance.

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd explode("<") and (">"), but there's probably a faster solution.


Bookmarks

Posting Permissions

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