开发者

PHP Regular Expression to find @someone

I need a regular in expression in PHP that I can plug into preg_match_all and find i开发者_运维百科f an @ sign and any character number or letter follows right after that.

So if I put

@patrick hello there

it will come up true, if I put in

"I saw her @ the mall"

it will be false.

Thank you


An at sign followed by at least one letter, number, or underscore:

/@\w+/


Great site on Regex: http://www.regexlib.com/CheatSheet.aspx

as well as http://www.regular-expressions.info/ as the fellow below me pointed out!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜