I am trying to write a regular expression to search for anything but digits or the *
or -
characters, with one caveat. Where I'm hitting a wall is that I need to be able to allow three or less digits to be found but not four or more, though even one *
or -
shouldn't be found.
This is what I have so far (for three matches):
.*?([^0-9\*-]+).*?([^0-9\*-]+).*?([^0-9\*-]+).*?
I have no idea where to insert {4,}
for the digits (I've tried and it doesn't seem to work anywhere) or how to change it to do as I want.
For instance, in "Jack has* 777 1883874 -sheep-"
I'd like it to return "Jack has 777 sheep"
. Or in "2343klj-3***.net"
I'd like it to return "klj 3 .net"