What's Wrong With The Non Capture Group In My Regular Expression
I'm trying to write a regular expression that will match a strings similar to the ones below: Yu MSBE26 w AWAQBNL I am using Javascript and have come up with the following regular
Solution 1:
Remove the second [AWMS\d]{2}
- it looks like an accidental addition and is the reason your regex doesn't work:
(.*?(?:[AWMS\d]{2})[A-Z]{2}[\dA-Za-z]{1,3})
Edit: you don't even need the non capture group, the square brackets are enough:
(.*?[AWMS\d]{2}[A-Z]{2}[\dA-Za-z]{1,3})
Post a Comment for "What's Wrong With The Non Capture Group In My Regular Expression"