That is a regex that would match:
stringAstring => A
stringAAAstring => AAA
stringAAAAAstring => AAAAA
[... and so on...]
But wouldn’t match:
stringAAstring => null
stringAAAAstring => null
stringAAAAAAstring => null
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the regex flavor you’re using supports look-arounds, this should work:
(AA)*Amatches an odd number of'A's and the(?<!A)asserts that it should not be preceded by an'A'and(?!A)asserts it should not be followed by an'A'.