My understanding of Regex isn't great and I need to adapt my working JS code to PHP.
This is one of the run-throughs in JavaScript (it finds hashtags and makes HTML anchor tags out of them):
exp = /(^|\s)#(\w+)/g;
messagetext = messagetext.replace(exp, "$1<a class='myHashtag' href='http://search.twitter.com/search?q=%23$2' target='_blank'>#$2</a>");
How would this be done in PHP?
preg_replace()
, for starters – Wiseguy Jun 8 '13 at 2:55