Skip to content

Instantly share code, notes, and snippets.

View isogram's full-sized avatar
🙊

Muhammad Shidiq isogram

🙊
View GitHub Profile
@BigglesZX
BigglesZX / Useful.Regexes.php
Created June 20, 2010 10:43
Some handy regular expressions (and attendant PHP code) that I've come across in my travels.
<?php
//
// some useful regular expressions and sample usage
//
// convert Twitter usernames into profile links
// cred. Simon Granade (http://bit.ly/FihuS)
$text = preg_replace('/(^|\s)@(\w+)/',
'\1@<a href="http://twitter.com/\2">\2</a>', $text;