开发者

PHP Regular Expression to find @someone

开发者 https://www.devze.com 2023-01-03 03:35 出处:网络
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.

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

精彩评论

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