How to match strings that start and end with the same character, but have an odd number of letters?
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 开发者_如何学JAVAthe 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
It should be almost the same:
^B.(..)*B$
精彩评论