On Wed 27 Sep, Dave Storrs wrote:
> 
> 
> On Wed, 27 Sep 2000, Richard Proctor wrote:
> > > Both \1 and $1 refer to what is matched by the first set of parens in a
> > > regex.  AFAIK, the only difference between these two notation is that
> > > \1 is used within the regex itself and $1 is used outside of the
> > > regex.  Is there any reason not to standardize these down to one
> > > notation (i.e., eliminate one or the other)?
> > 
> > I think this is fixable.  
> 
>       The way you phrase that makes it sound that other people perceive
> this as a problem as well, which gives me all sorts of warm fuzzies. :>
> 
> > The only real need for this at the moment is to overcome limitations in
> > the order of expansion of regexes.  RFCs 112, 166, 276... all depend on
> > fixing this.  
> 
>       Ok, here's another question.  How the _HELL_ does everyone else on
> this bloody list keep track of every detail in every frigging RFC?  Some
> random comment comes up, and someone will go, "Oh, the third paragraph of
> the second section in RFC 0x97A already mentioned this as a parenthetical
> aside, despite the fact that its title and primary topic had no relation
> to the issue."  I still have (mumble-mumble) RFCs that I haven't even had
> time to *read*, let alone memorize every detail of!

In this context I was the author of guess what 112, 166 and 276 (though 
I admit to having to look up the number of the last one)

> 
>       Grrrrrr....*grumble, grumble, moan, winge*
> 
>       Ok, back to rationality now.
> 
> > If the regex compiler gets in before the expansion of the variables to
> > make these work, it could handle $1 in all cases \1 can be retained for
> > compatibility.
> 
>       Do we *want* to maintain \1?  Why have two notations to do the
> same thing when one is clearly superior?  (\1 can only go up to \9 while
> the other could theoretically go to ${9999...}.)  Perl6 is breaking
> backwards compatibility and eliminating all deprecated features...let's
> get rid of \n as backreference notation.
> 

The principle issue would be what to do about use of $1 on the LHS having
its current meaning.  Which is rather good for obfuscated code, but not
terribly kind on normal programming.

Note RFC 112 covers assignment within a regex naming rather than numbering
the brackets one wishes to capture, it also covers named back references.

Currently $1 is expanded by the quoting currently before the regex compiler
gets to play, the regex compiler sees the \1 and knows what to do.  \ meaning
refer back I am reasonably happy with, the numbers I am not.

Richard

-- 

[EMAIL PROTECTED]

Reply via email to