Example of detecting links in a text string with PHP preg_replace()
This is an example of the ORIGINAL POST "How to detect links in a text string with PHP".
Original string
http://www.anerbarrena.com https://www.facebook.com www.google.es @anerbarrena #anerbarrena
Filtered string with normal links
http://www.anerbarrena.com https://www.facebook.com www.google.es @anerbarrena #anerbarrena
Filtered string with normal and Twitter format links
http://www.anerbarrena.com https://www.facebook.com www.google.es @anerbarrena #anerbarrena