[英]Regex whitespace followed by special character
Hey guys I thought I had this locked down, but testing proved otherwise. 大家好,我以为我已将其锁定,但测试证明并非如此。
I need a regex that simply matches a whitespace followed by an @ symbol 我需要一个正则表达式,它只与一个空格匹配,后跟一个@符号
ie. 即。 ' @' '@'
Currently my regex of 目前我的正则表达式
str.match(/[\s\@](.+)$/)
Returns true is there is a whitespace AND an @ anywhere in the string 如果字符串中有空格和@,则返回true
Example of what not to match 'asd asd@' 不匹配“ asd asd @”的示例
Example of what should match 'asd @asd' 应匹配“ asd @asd”的示例
I'm stuck, help appreciated :/ 我被卡住了,帮助表示赞赏:/
为什么不简单使用
str.match(/\s@/)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.