I have the following regex defined:
const regEx = new RegExp('[A][A-Z]{2}[0-2]{5}\b', 'g')
I have tested it in online regex testers and they all seem to work. I would like to search through a string for all words that look like this: ADB12210. They have to start with an A followed by 2 upper case letters and end with 5 numbers from 0-2 and be a global search since this could appear multiple times in the string. This seems to work but when I try it by creating a pipe in angular it doesn't find any matches. The match returns null but I am expecting an array like: ['ADB12210', 'ACG12212']. My pipe is as follows:
transform(value: string): any {
const regExp = new RegExp('[A][A-Z]{2}[0-2]{5}\b', 'g')
console.log(value.match(regExp)
}
Even if I hard code the check it still returns null:
const string = 'ACG12212'
console.log(string.match(regExp)
regExp = /\b[A][A-Z]{2}[0-2]{5}\b/g