tags:

views:

62

answers:

3

Hello, I am in dire need of a such regular expression where my alphabet is made up of 0s and 1s.

Now I need a language that accepts all words as long as it has three 0s.

IE:

000 10001 0001 1000 10000101

+4  A: 

Three consecutive zero chars:

\b[01]*0{3}[01]*\b

Note
It is not entirely clear whether this is what OP wants.

Edit
Apparently it was :)

jensgram
+3  A: 
\b(1*0){3}

will also match if the three zeros are not consecutive.

This only matches as much as required (i.e. up until the third zero). If you want it to match the entire number, use

\b(1*0){3}[01]*\b
Tim Pietzcker
+1 Elegant and nice thought to only match "as much as required".
jensgram
A: 

You mean a number that can be divided by 3 zeros, such as 3, 6, 9? or 3 more or zeros?

Noona
Divide by zero? Huh? Oh!... :)
Tim Pietzcker
If a number can be divided by two zeros, can you divide that number by three zeros?
Amarghosh
right, the statement should've been written as"a number of zeros that can be divided by 3" :)
Noona