Reputation: 112
I've tried the following solution but it may not cover all the strings
b(aa+ab+ba+bb)* + (aa+ab+ba+bb)*b
here + means OR operation and * means repetition.
Can someone debug the above regex?
Upvotes: 0
Views: 965
Reputation: 562
RE = (a+b)((a+b)(a+b))*
b(a+b)((a+b)(a+b))*
+
((a+b)(a+b))*
b((a+b)(a+b))*
I hope it will cover all strings
Upvotes: 1
Reputation: 607
check out this ..
b((a+b)(a+b))*
this results in generating strings with minimum length 1 i-e odd as per your requirement also containing (b);if you take closure once
for more than 1 odd lengths take closure multiple times
Upvotes: 0