MartijnK MartijnK - 1 year ago 63
Javascript Question

Regex pattern to find a multiple non-digit characters recurring

I'm trying to get regex to find matches where in a string of numbers there are more than one instance of a non-digit chracter following each other.


would not be a match, but
would be (twice).

Thus far I have mangled this together:
, which checks for multiple instances of
() -+
following each other, but it misses
for instance.

([()\\-+ ])\\1
also finds two (or more) of the same character in a row, but it misses

I'm assuming that something like a not-digit (
) would be easier than defining every character you don't want, but I don't see how to include that.

Answer Source

There is a not-digit character class which is \D, so just try \D\D
See this regex101 for a quick example

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download