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
Post a Comment