简体   繁体   English

正则表达式空格后跟特殊字符

[英]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.

相关问题 Java Regex:匹配一个字符后跟空格? - Java Regex: Match a character followed by whitespace? 正则表达式匹配重复模式,一个字符后跟一个空格 - Regex matching repeated pattern, one character followed by a whitespace 不允许正则表达式 大写字母后跟小写字母后跟数字后跟特殊字符 - Regex not allowed Capital letter followed by lower case letters followed by number followed by special character 正则表达式 - 检查直到字符串末尾没有任何字符的特殊标记 - Regex - check for a special token not followed by any character until the end of string Java正则表达式模式替换空格后跟特殊字符 - Java regex pattern replacing space followed by special character Regex python - 仅当换行符后跟数字或特殊字符和空格时才匹配换行符 - Regex python - Match newline only if it is followed by number or special character and space 正则表达式:在空格上分割一个字符串+每个要包含的特殊字符 - Regex: split a string on whitespace + each special character to be included separately 正则表达式验证字符串是否不包含特殊字符列表和允许的特殊字符后跟字母数字 - Regex validate string if it does not contain list of special character and allowed special character followed by alphanumeric 正则表达式匹配逗号后跟空格? - Regex to match comma followed by whitespace? 正则表达式查找与任何空格加上一个特殊字符加上一个空格加上任何异常的匹配: - REGEX to find match with any whitespace plus a special character plus a single whitespace plus anything with exceptions:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM