possessive property

Quantity possessive

A possessive quantifier is similar to a greedy quantifier. It indicates the engine to start by checking the entire string. It is different in the sense if it doesn't work: if there is no initial match, there is no looking back. E.g. this can be used to increase performance.

Example: var regex = FluentRegex() .anyCharacter(Quantity.zeroOrMoreTimes().possessive) .literal('foo'); expect( () => {regex.hasMatch('xfooxxxxxxfoo')}, throwsA((e) => e.toString()== 'FormatException: Nothing to repeat.*+foo'));

Implementation

Quantity get possessive =>
    Quantity._(_expression, MultiplicityMode.possessive);