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

RE: using search backreferences in a variable

Thread Previous | Thread Next
Jeff 'japhy' Pinyan
March 28, 2002 12:26
RE: using search backreferences in a variable
Message ID:
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
RPI Acacia brother #734
** 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.  ]

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About