develooper Front page | perl.perl6.language | Postings from September 2005

[regex] \&

Thread Next
From:
Ruud H.G. van Tol
Date:
September 26, 2005 12:35
Subject:
[regex] \&
Message ID:
012901c5c2d1$5d9d7200$0b01a8c0@isolution.nl
Think about adding \& to the replacement part of a s///.

As in sed, the & means the whole match.


Then one can do

  s/$search/*\&*/go

in stead of

  s/($search)/*\1*/go

and there needs to be no $1 variable set up.

(I assume that using () always makes a $1 available, even if it is not
being used.)

-- 
Grtz, Ruud


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