Related (but slightly different):
http://stackoverflow.com/questions/1216007/surrounding-all-instances-of-and-http-with-a
I would like to surround all instances of @_______
, #________
, and http://________
with anchor tags in one pass.
For example, consider this Twitter message:
The quick brown fox @Spreadthemovie jumps over the lazy dog #cow http://bit.ly/bC9Dy
Running it with the desired regex pattern would yield:
The quick brown fox <a href="a">@Spreadthemovie</a> jumps over the lazy
dog <a href="b">#cow</a> <a href="c">http://bit.ly/bC9Dy</a>
Only surround words that start with @
, #
or http://
so that [email protected]
would not become dog<b>@gmail.com</b>
.