[^0-9]
This will match all characters that are not ASCII digits.
If Unicode digits are also to be negated, the following expression can be used, depending on your flavor/language settings:
[^\d]
This can be shortened to:
\D
You may need to enable Unicode character properties support explicitly by using the u
modifier or programmatically in some languages, but this may be non-obvious. To convey the intent explicitly, the following construct can be used (when support is available):
\P{N}
Which by definition means: any character which is not a numeric character in any script. In a negated character range, you may use:
[^\p{N}]
In the following sentences:
Hi, what's up?
I can't wait for 2017!!!
The following characters will be matched:
,
,,
'
,?
, the end of line character and all letters (lowercase and uppercase).
'
,,
!
, the end of line character and all letters (lowercase and uppercase).