22 February, 2010

Regular Expression to Find All Mentioned Names by ‘@’

I have seen a cool example about it at Junal vai's blog. Here is a shortcut example of it..
  1. function name_from_at($string)
  2. {
  3.     $pattern = "/@([a-zA-Z0-9]+)/i";
  4.     preg_match_all($pattern,$string,$array);
  5.     return $array[0];
  6. }
Enjoy..... Help the people of Haiti......

No comments:

Post a Comment