php preg_match验证twitter用户名

What is the pattern to validate a twitter username using preg_match?

Twitter allows you to use letters, numbers, and '_', so

preg_match("/[a-z0-9_]+/i", username)

for a case-insensitive search with at least one character.

I think greg forgot the "@" that indicates the beginning of a twitter handler:

preg_match("/\@[a-z0-9_]+/i", $username);

Better yet:

preg_match('/^\@[\w]+$/', $value);