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

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

Thread Previous | Thread Next
From:
Ilya Zakharevich
Date:
August 8, 2000 17:27
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex operators.
Message ID:
20000808202748.C11798@monk.mps.ohio-state.edu
On Sun, Aug 06, 2000 at 11:47:40PM -0700, Jeffrey Friedl wrote:
> |> Such as?  And can you explain them using the better/worse language of
> |> "Combining pieces together", or can they only be understood if you use
> |> terms like "backtracking"?

[...]

> But that's okay, since I don't believe that \1, \2, etc. could be described
> in that respect, either, since exactly what they even mean (what substrings
> they'll match) can change over the course of the regular expression
> application.

*This* is your problem.  And I would think that this not-understanding
of yours may be related to your remarks on math.  Here is the
conjecture I got reading what you wrote: 

  one of the difficulties associated to math is that it progresses by
  *unlearning* things.  "Number is what can be written as
  numerator/denominator", "No, one should allow also infinite decimal
  fractions", "No, number may have an imaginary part too", "No, the
  part before the dot may be infinite too" (these are p-adics, BTW)
  etc. etc. etc.  Note how things progress by removing restrictions
  which turn out to be unnecessary/hindering.

You know too much. In this whole discussion you refuse to *unlearn*
your knowledge of NFA and backtracking.  You still refer to the "match
as a process which progresses in time".  I consider the discovery that
this is *not nessary* as one of my largest contributions to the Perl
REx arena [*].  [For an alternative - and magnificently failing -
POSIX-related approach see TCL's engine.]  

You are still free to think in the terms of backtracking, if this is
more convenient to you.  However, any change to the REx engine which
*requires* one to think in terms of backtracking is a significant step
back.

[*] One still needs backtracking to understand how (?{}) works, but I
    hope that enhancements to (?{}) will remove this exception ASAP.

P.S.  About \1 etc.: given a match, you know which parts of the string
      are "encircles" by particular ()'s.  In a correct match \1, \2
      etc should match *the same string*.  As easy as that.

      Say, \1(a) should match "aa".  If it does not work now, it is a
      bug.  [The "correct" behaviour would be to reject/warn-on this
      at compile time.]

Ilya

Thread Previous | Thread Next


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