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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -