簡體   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