1

The expression /\d5/g , matches with "15" in "155", but not "55".

How do I modify the expression so it matches with "15" and "55" in "155"?


Apparently, I have to do something called a "lookahead assertion".

let str = '155';
let regEx = /(?=(\d5))/g;
let matches = str.matchAll(regEx);

1 Answers1

0

I don't know your parser, but maybe you have to say, that the "5" can occure more-times.

Something like this:

let regEx = /(?=(\d5)*)/g;