Re: Regex not working correctly

2013-12-11 Thread punit jain
That answers my question. Thanks Robert

Re: Regex not working correctly

2013-12-11 Thread Robert Wohlfarth
On Wed, Dec 11, 2013 at 10:35 AM, punit jain wrote: > > Thanks Shlomi, thats a good idea. However at the same time I was trying to > understand if something is wrong in my regex. Why would $2 capture the > number as I have used :- > > (?:(91\d{10}|0\d{10}|[7-9]\d{9}|0\d{11})|(?:(?:ph|cal)(\d+))) >

RE: Regex not working correctly

2013-12-11 Thread vijaya R
Hi, You can try the below pattern. if($line=~/([0-9]{3,})/gs) { print $1; } Thanks, Vijaya -- From: punit jain Sent: 12/11/2013 9:07 PM To: beginners@perl.org Subject: Regex not working correctly Hi, I have a requirement where I need to capture phone

Re: Regex not working correctly

2013-12-11 Thread punit jain
Thanks Shlomi, thats a good idea. However at the same time I was trying to understand if something is wrong in my regex. Why would $2 capture the number as I have used :- (?:(91\d{10}|0\d{10}|[7-9]\d{9}|0\d{11})|(?:(?:ph|cal)(\d+))) This would in my understanding match either number with regex 91

Re: Regex not working correctly

2013-12-11 Thread Jim Gibson
On Dec 11, 2013, at 7:34 AM, punit jain wrote: > Hi, > > I have a requirement where I need to capture phone number from different > strings. > > The strings could be :- > > > 1. COMP TEL NO 919369721113 for computer science > > 2. For Best Discount reach 092108493, from 6-9 > > 3. Your b

Re: Regex not working correctly

2013-12-11 Thread Shlomi Fish
Hi punit, On Wed, 11 Dec 2013 21:04:39 +0530 punit jain wrote: > Hi, > > I have a requirement where I need to capture phone number from different > strings. > > The strings could be :- > > > 1. COMP TEL NO 919369721113 for computer science > > 2. For Best Discount reach 092108493, from 6-9

Regex not working correctly

2013-12-11 Thread punit jain
Hi, I have a requirement where I need to capture phone number from different strings. The strings could be :- 1. COMP TEL NO 919369721113 for computer science 2. For Best Discount reach 092108493, from 6-9 3. Your booking Confirmed, 9210833321 4. price for free consultation call92504060 5.