I'm attempting to take a string and find/replace all the hashtags into links. This works except it messes up the html in the string, I want to ignore all html entirely.
#testing <span style="color: #bbbbbb">#asdfasd</span> #test
Right now using this:
$string = preg_replace_callback('/#([a-zA-Z_]+)/', array($this, 'renderHashTag'), $string);
#testing, #bbbbbb, #asdfasd, and #test all get picked up and I don't want #bbbbbb or #asdfasd to. I've tried several different things before posting here, I just can't seem to figure out how to ignore the html tags, someone recommended removing them but I don't want to do that as some of it may be important to the styling.