I would like to match by regex strings of 01 which have odd length.
Example: "0","001","111","11111" etc.
The idea is the odd length sequences are 0 or 1 followed by pairs of 0 or 1. But my regex seems not working.
I made this:
String regex = "[0-1]{1}[[0-1]{2}]{0,}";
String txt = "01";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(txt);
System.out.println(m.matches());
Try this: