valoricDe / MultiRegExp2

Get all matches of a regexp with corresponding start and end positions
GNU General Public License v3.0
12 stars 5 forks source link

| (or) in combination with capturing parentheses doesn't work #12

Open jens-duttke opened 5 years ago

jens-duttke commented 5 years ago

I have a problem with the | operator and capturing groups in my regexp:

const MultiRegExp2 = require('multi-regexp2').default;

const matches = new MultiRegExp2(new RegExp('(a)|(b)')).execForAllGroups('b', true);

console.log(matches);
// -> null

Normally the matches should looks like this: https://regex101.com/r/jn9DU9/1

Full match 0-1 b
Group 2. 0-1 b