slevithan / xregexp

Extended JavaScript regular expressions
http://xregexp.com/
MIT License
3.31k stars 278 forks source link

Can we have some position information in Unbalanced delimiter error? #293

Closed 3cp closed 3 years ago

3cp commented 4 years ago

Related to #96

I wonder is it possible to add position information to the error message?

Unbalanced delimiter found in string
    at Function.XRegExp.matchRecursive (node_modules/xregexp/lib/addons/matchrecursive.js:211:15)

Something like

Unbalanced delimiter found in string, for left delimiter at position 123

So that it's easier for user to find out where is the problem in the input string.

slevithan commented 4 years ago

Great suggestion! PRs welcome. :)