I have to admit that regex is something that always sends me crosseyed.... one day I will get my head around it.
I have a small piece of code that is used to create hyperlinks for things like #Facebook from a Twitter RSS feed.
It works ok, however sometimes we get: #Facebook, or #Facebook: or #Facebook.
What I would like is to also remove these common end characters such a commas, colons and periods.
This is the code I currently have:
$description = preg_replace("/#([^ ]+)/", "<a href=\"https://twitter.com/#!/search/%23$1\">#$1</a>", $description);
Any help appreciated!