develooper Front page | perl.perl5.porters | Postings from August 2000

Re: Proposal for \v and \V, the small- and large- cut regex operators.

From:
Jeffrey Friedl
Date:
August 9, 2000 03:46
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex operators.
Message ID:
200008091046.DAA12353@ventrue.yahoo.com

|> IIRC, much of that discussion concerned convertion parts of the RE
|> from NDFA to DFA.  I don't think you can get more 'anti-backtracking'
|> that that.

If there are no capturing parentheses, it'd be perfectly reasonable to use
a DFA. The m/foo(?:.*)bar/ example could certainly be made into a DFA
without changing the user-visible match semantics.

There's a larger startup cost with a DFA, and this may be sufficiently bad
for simple tests on short strings that it's not worthwhile, but the concept
is fine.

Even if there are capturing parenthese and backtracking, there are
techniques to make hybrid NFA/DFA engines that preserve the runtime
semantics of the original NFA, but enjoy some speed enhancements of a DFA. 
(I don't know much about the construction of these hybrids, but do know
that Henry Spencer was actively working on this as early as 1995).

	Jeffrey
------------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@yahoo-inc.com> Yahoo! Finance http://finance.yahoo.com
O'Reilly's Regular Expression book: http://public.yahoo.com/~jfriedl/regex/



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About