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:[email protected]] Sent: Wednesday, June 17, 2009 5:15 PM To: [email protected] 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 <[email protected]> To: Irfan Sayed <[email protected]> Cc: "[email protected]" <[email protected]> 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:[email protected]] Sent: Wednesday, June 17, 2009 4:10 PM To: [email protected] 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: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/ -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
