简体   繁体   中英

Searching for non numeric characters, except for a “.”, using regex

我一直在使用“(\\ D)”查找数字字符串的结尾,但是它也检测小数点,如何更改正则表达式键以允许检测除“”以外的所有非数字字符。 ”。

how can the regex key be changed to allow for the detection of all non numeric characters except for a "."

[^\d.]

This pattern matches any non-digit character but not of a dot.

我用以下方法解决了问题:

[^0-9.]

最简单的方法是将字符类\\ D与character一起使用

[\D.]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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