Reputation: 1271
Trying to come up with a regex to capture groups like AB1234
or BA2321
.
Essentially need to capture anything that starts with AB or BA and followed by 4 digits.
Currently, I have something like this, but that seems to not take numbers into account
(AB|BA)\d{4}
Upvotes: 0
Views: 46
Reputation: 91373
May be you want:
\b((?:AB|BA)\d{4})\b
Letters + digits will be in group 1
Upvotes: 1