It works for all Just get any no after two (.) dot For that regex would be My $line="\"ProductName\" = \"8:EXFO RTU System 1.2.42\""; my ($lastvalue)=$line=~ m/\d+.\d+.(\d+)\"/;
$lastvalue will give you value after two dot Increment it by one and then replace it by old value from the line It works For all Thanks Ajay -----Original Message----- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, June 17, 2009 5:15 PM To: beginners@perl.org Subject: Re: regular expression help it is not just 1.2.43 it may be anything it may be like 2.3.56 or 2.0.12 and so on... plz advice ________________________________ From: Ajay Kumar <ajay.kum...@synopsys.com> To: Irfan Sayed <irfan_sayed2...@yahoo.com> Cc: "beginners@perl.org" <beginners@perl.org> Sent: Wednesday, June 17, 2009 5:01:41 PM Subject: RE: regular expression help Hi Irfan This code solve your problem my $p="\"ProductName\" = \"8:EXFO RTU System 1.2.42\""; my ($val)=$p=~ m/\d+.\d+.(\d+)\"/; my $inval=$val+1; $p=~s/$val/$inval/; print"===$p\n"; thanks Ajay -----Original Message----- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, June 17, 2009 4:10 PM To: beginners@perl.org Subject: regular expression help Hi All, need help on regular expression. i have string like this "ProductName" = "8:EXFO RTU System 1.2.42" now i want regular expression in such a way that it will change the line to : "ProductName" = "8:EXFO RTU System 1.2.43" i tried in the following way. $_ =~ s/:(.*)\s(.*)\s(.*)\s\d*.\d*.\d*/:(.*)\s(.*)\s(.*)\s$chver)/; where $chver is variable which contains value as 1.2.43 it is not giving result as exprected. plz advice regards irf -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/