----- Original Message ----
From: D. Bolliger <[EMAIL PROTECTED]>
To: beginners@perl.org
Sent: Sunday, January 21, 2007 7:43:19 PM
Subject: Re: putting ";" as a replacement in the substitution.

> Because everything matched - that is: vd=\w+(,) - is replaced with the 
> semicolon.

> You seem to misunderstand the meaning of the capturing parenthesis '()' on 
> the 
> left part of the substitution: They do not indicate the part of the string 
> that is to be replaced; replaced is what the left side of the substitution 
> matches.

I see... so in substitutions, all patterns in the left side are those that have 
to be substituted, regardless of which is enclosed in parenthesis.

However in a plain regexp look ups, only those inside the parenthesis are being 
matched...

I tried explaining my experiment here.

http://www.mail-archive.com/beginners%40perl.org/msg82761.html


> And how to get around with it..

One way is:

$string =~ s/(vd=\w+),/$1;/;


It did work, as someone has already suggested.

Thanks.
Now, it's a lot clearer.


> There are several man pages, where also the capturing parenthesis and the $1..
> $n variables are explained:

> perldoc perlre
> perldoc perlretut
> perldoc perlrequick

> Hope this helps!


Dani

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/









 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

Reply via email to