繁体   English   中英

如何使用正则表达式匹配除加号以外的所有非数字字符?

[英]How to match all the non numeric characters except a plus symbol using regular expression?

如何使用正则表达式匹配非0-9和+的任何字符? 我希望能够匹配除数字和加号以外的所有字符。

/ \\ D + /匹配所有不是数字的字符,但我希望它对于数字和+为假

按照regex101示例 ,使用[^0-9+]+模式:

[^0-9+]+

Match a single character not present in the list below [^0-9+]+

+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
+ matches the character + literally (case sensitive)

您可以使用以下表达式:[^ 0-9。$]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM