tags:

views:

44

answers:

2
^[0-1]*1[0-1]*1[0-1]*1[0-1]*$

To match a binary string with 3 or more occurrences of '1' This expression works...just trying to make it better.

+1  A: 

To match three or more occurrences of 1, I would use:

^(0*1){3}[01]*$
zebediah49
Note that you can change that three to anything, and you get that many '1's in the matches.
zebediah49
Sorry about confusion, my mistake i did mean at least 3 '1's
Dacto
Change the last 0 to [01] and you're golden.
Mike DeSimone
or use the `{3,}` syntax (means 3 or more)
glebm
+1  A: 

i think it'll be something like this, edited changed with alans suggestions

^(0*1){3,}0*$