[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: english names for symbolic SREs

On Thu, Nov 28, 2013 at 10:46 AM, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:

Note that Java
has not only greedy and reluctant (= non-greedy), but also possessive
(notated *+, matches everything, never backtracks).  I have been unable
to see the use of this, however.

This, unsurprisingly, is also originally from PCRE,
where PAT*+ a shortcut for (?>PAT*), available as
(atomic (* PAT)) in IrRegex.

It's an optimization technique to avoid exponential
backtracking, analogous to cut in Prolog.  Thus
by definition it only makes sense in a specific
backtracking implementation.