JSVerbalExpressions
JSVerbalExpressions copied to clipboard
Support for non-greedy/lazy wildcards
Hey,
I've recently found about about this package and started to convert or regexes :)
One major thing I noticed missing is the ability to add lazy/non-greedy wildcards.
I thing All functions that make use of the '' or '+' wildcard should have an optional parameter or an equivalent functions that uses '?'/'+?'
Since the code puts most of the expressions in a non-capturing group we can't just use .add('?')
afterward.
This was discussed a bit in the dart repo. This is really important to avoid unexpected inclusion in the wildcard.
Effected functions: anything, anythingBut, something, somethingBut, multiple.
OneOrMore should probably be included as well but currently it doesn't use a non-capturing so we still follow it up with .add('?')
This is going to be a thing in version 2. You'll be able to use multiple.lazy
and multiple.greedy
(alias) in addition to multiple
and similarly with the rest of the repetition operators.