Hi,
I have a search page that searches through a database, stores the results into a string and then highlights the text in the string that matches the search query.
i.e.
If I search for "width", then if "The width of a cabinet" was in the database, the word "width" would be highlighted. It uses <span class='highlight'>width</span> to highlight the text.
I have the highlight feature working, the problem is that the database contains both HTML code and ordinary text to be displayed on screen. So when I search through the database to highlight certain pieces of text, it also highlights HTML code if it matches.
In the example above, it would take "<td width='150'>" and change it to "<td <span class='highlight'>width</span>='150'>"
Does anyone know how I can use regular expressions (or another option if there is one) to search through and ignore the HTML code in the string?