Dear Friend!

Sorry Again disturbing you.

I have a string

$str = "Total Mobile HONDA Civic, EXI: model 2002, excellent condition, 
available for sale. My Phone # is. 042-6832797, My Cell. 0300-4459899, My 
Office Cell is0300-5009228, my other mobile no is 0356-4094030, my Friend 
Mobile no is . 03226789871";

I want to print all mobile from above string. In Pakistan mobile always start 
from 03.

So here I have use this regular expression.

while($str =~ /(\b(0([3](\d\d)))+[-]+\d{7}|\b(0([3](\d\d)))+\d{7})/g){
        print "Your Mobile No. is " . $1 . "\n";
      }

Here is the output of while

Your Mobile No. is 0300-4459899
Your Mobile No. is 0356-4094030
Your Mobile No. is 03226789871

its Work almost fine but one mobile no. is missed and that is  My Office Cell 
is0300-5009228

As you can see its not works because there is no space after the word is So 
would you please help me how to solve this.

Best Regards,

Umar


      

Reply via email to