java - Matching regular expression OR and AND -
i have requirement match 1s or (and) 0s using regular expression.
for example
^((1+|0+)|(1*,0*))1((1+|0+)|(1*,0*))1+((1+|0+)|(1*,0*))$
matches 01001110
. know how match "either series of 1 or series of 0 or mixed series of 1 , 0"
i have tried following , doesn't work string 1010
.
^((1+|0+)|(1*,0*))1+((1+|0+)|(1*,0*))$
the idea in this problem, "a"s can represented 1+ or 0+ or mix of both. i'm trying derive regular expression shown above.
i not sure if want if want find series contains 1
and/or 0
regex can (1|0)+
can written using character class [01]+
Comments
Post a Comment