Reputation: 12517
I'm trying to formulate a regex that identifies strings that begin and end with 'B" but also have an odd number of letters overall. So far I have the following:
Strings that start and end with B:
^B.*B$
I am not sure how to get it so that it only accepts an odd number of letter. For even numbers it's easy:
^B(..)*B$
But odd is throwing me a little
Upvotes: 4
Views: 439