But I don’t want to match 12,2, or 234432 53. I want to match whether string contains 1 2 OR 1,2 OR 1,2,3 OR 1 2 3 Or any such combinations. And I think this reg. exp. is doing that job.
-----Original Message----- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 5:16 PM To: Sayed, Irfan (Cognizant) Cc: [EMAIL PROTECTED]; beginners@perl.org Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] пишет: > Because I want comma (,) exactly once > > -----Original Message----- > From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 14, 2008 4:41 PM > To: Sayed, Irfan (Cognizant) > Cc: [EMAIL PROTECTED]; beginners@perl.org > Subject: Re: Regarding reg. exp. > > [EMAIL PROTECTED] пишет: > >> if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) >> >> this what I did. >> >> >> >> > Hi! > > Why have you used {1} quantifier? > > No, its not correct. if you mention for example \d this will match *single* digit. Your regex will match 1,2 or 1 2, but *not* 12,2 or 234323 53 if ($trig_np =~ m/ \d+ [,\s] \d* /x) is much more correct This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.