Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: help in reg...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 10969 of 11518
Post > Topic >>

Re: help in reg. exp.

by rob.dixon@[EMAIL PROTECTED] (Rob Dixon) Apr 21, 2008 at 07:40 PM

Irfan.Sayed@[EMAIL PROTECTED]
 wrote:
> 
> I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
> contains .0 at the end then I want to remove that .0 but if any other
> digit is there other than .0 then don't do anything.
> 
> For example: if string is : OMS.FD.08.03.000.0 then regular expression
> should give OMS.FD.08.03.000
> 
> But if string is : OMS.FD.08.03.000.18 then don't do anything 

sub remdotzero {
  my $str = ****ft;
  $str =~ /(.*?)(?:\.0)?$/;
  return $1
}



Rob
 




 4 Posts in Topic:
help in reg. exp.
Irfan.Sayed@[EMAIL PROTEC  2008-04-21 16:47:02 
Re: help in reg. exp.
chas.owens@[EMAIL PROTECT  2008-04-21 07:24:15 
Re: help in reg. exp.
peng.kyo@[EMAIL PROTECTED  2008-04-21 20:05:22 
Re: help in reg. exp.
rob.dixon@[EMAIL PROTECTE  2008-04-21 19:40:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 13:05:44 CDT 2008.