develooper Front page | perl.beginners | Postings from April 2002

RE: using search backreferences in a variable [end]

From:
Bryan R Harris
Date:
April 1, 2002 08:47
Subject:
RE: using search backreferences in a variable [end]
Message ID:
OF53C17560.90774443-ON07256B8E.005BF77F@rsc.raytheon.com

Thanks, Jeff!

- B

__________________


On Mar 28, Bryan R Harris said:

>- Why is the \1, \2, etc. syntax obsolete?  The one thing I love about
>regular expressions is that I can use them within text editors (nedit,
>textpad, bbedit), but none of these support the $1 notation in the replace
>string.  Why aren't re's consistent between perl and text editors?

\1 and \2 are to be used on the LEFT-HAND side of a regex; on the
RIGHT-HAND side, you should use $1 and $2 to remove any ambiguity, because
\1 can ALSO mean chr(1).

>- What does the "qr" tag do?

qr// makes a Regexp object that is a compiled regular expression.

--
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]





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