Regular Expressions: Remove Links Hashes & Mentions from Tweet

Use this regular expresion to remove URLs (http://…) hashes (#ahash) and mentions (@amention) from Tweets or any other block of text for that matter.

For PHP code use:

/(@|#|http\:\/\/)([a-zA-z0-9\.\/])+/

 

For JavaScript:

^(@|#|http\:\/\/)([a-zA-z0-9\.\/])+$