Ella has asked for the wisdom of the Perl Monks concerning the following question:
I need to search various texts in Italian. These texts may be produced by any number of unknown different authors using slightly different conventions. I need to pull out as many of the telephone or fax numbers as possible with as low a rate of false positives as possible (I'd rather pick out 1 of 10 numbers accurately than get 11 out of 10 if you follow). The format of the numbers is variable. Unlike the north american (000) 000-0000 format, telephone and fax numbers in Italy can be anywhere from 3 to 15+ digits in length. Numbers can include .'s, spaces, /'s, -'s and ()'s and may be preceded by a space or a +
here are *some* examples of commonly used telephone number formats with their contexts:
poliambulatorio 050/701901
Tel. +39 0422 519111
Fax +39 0422 969501
Phone: +39.087105891
Fax: +39.0871562496
(+39) 06 6783933
(+39) 06 678793
Tel: 0668136061
Phone 39-0445-575870 Fax 39-0445-575399
P.I. 02212120246
Telefono 091.545606
these are the constraints that I have come up with so far, the problem is that it's a little too constraining and I'm not getting any results at all.
Thanks for your help. Thanks especially to LAI for helping me make this question a tad less silly.m/ ( numer ( i (tel|utili|verdi|facsimili|fax) |o (verde|tel|facsimile|fax|tel) ) |t: |f: |fax |al\snumero |phone |p.i. ) [^\d]{,7} (\d\s*){3,15} ([^\d]|$) /gx
'share and enjoy'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp quandry
by japhy (Canon) on Jun 19, 2003 at 22:47 UTC | |
|
Re: regexp quandry
by LAI (Hermit) on Jun 20, 2003 at 13:25 UTC | |
|
Re: regexp quandry
by Ella (Acolyte) on Jun 27, 2003 at 00:09 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |