What would be a regular expression that accepts all strings of 0’s of length k where k is a multiple of 2 or 3?
For example, it should accept '', '00', '000', '0000', '000000' and reject '0', '00000', '0000000', '00000000000'.
>Solution :
^((00)*|(000)*)$ should do it. It matches 0 or more instances of 00 or 0 or more instances of 000, with the ^…$ making the pattern apply to the entire string instead of a substring.