Hi
I want to highlight a portion of a text using a <font....> Tag and str/preg_replace. This portion must not be in a HTML Tag. How is this possible? Using a regular expression (saying that the text must not be in this <> brackets)? Or is there an option or special function?
str/preg_replace excluding HTML tags
preg_replace() will do that nicely
/([i]stuff to match here[/i])(?=[^<>]*(?:<|$))/
That's totally off the top of my head, though. What it does is finds the pattern you're looking for, then scouts ahead to make sure there aren't any > characters before the next < (or the end of the string) turns up. The bit that's replaced will only be the stuff to match here bit.
That worked perfectly, thank you.