I'm still unable to get .exec() to match with the ? quantifier. If the same quantifier is run in a JS regex tester the the match would work but displays a warning. This is apparently a known limitation of .exec(). The challenge is documented here.
Older versions of matchEnemies used .match() which worked as expected. Here's the final commit of matchEnemy() which used the old method.
I'm still unable to get
.exec()
to match with the?
quantifier. If the same quantifier is run in a JS regex tester the the match would work but displays a warning. This is apparently a known limitation of.exec()
. The challenge is documented here.Older versions of
matchEnemies
used.match()
which worked as expected. Here's the final commit of matchEnemy() which used the old method.exec()
docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/execmatch()
docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchRelated Issue: https://github.com/gricha2380/regex/issues/33
Related Stackoverflow reference: https://stackoverflow.com/questions/2295657/return-positions-of-a-regex-match-in-javascript