Regex - How do you match everything except four digits in a row? -


using regex, how match except 4 digits in row? here sample text might using:

foo1234bar baz      1111bat asdf 0000 fdsa a123b 

matches might following:

"foo", "bar", "baz      ", "bat", "asdf ", " fdsa", "a123b" 

here regular expressions i've come on own have failed capture need:

[^\d]+            (this 1 includes a123b) ^.*(?=[\d]{4})    (this 1 not include line after 4 digits) ^.*(?=[\d]{4}).*  (this 1 includes numbers) 

any ideas on how matches before , after 4 digit sequence?

you haven't specified app language, practically every app language has split function, , you'll want if split on \d{4}.

eg in java:

string[] stufftokeep = input.split("\\d{4}"); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -