in reply to Re: Phone Number Regular Expression
in thread Phone Number Regular Expression

One more question: what if the phone number is split over two lines? Is there any way to easily deal with that?

Replies are listed 'Best First'.
Re^3: Phone Number Regular Expression
by Roy Johnson (Monsignor) on Mar 16, 2006 at 20:25 UTC
    Sure. If you are saying that $_ has newlines in it, you can just remove them with tr/\n//d. Then process as before.

    It may be slightly trickier if you're saying the number is split across lines in an input file that you're reading one line at a time. Basically, you'll want to remember some of the previous line while you read the next line, stick them together, then look for the phone number. Exactly how you work that out depends on what you know about your input.


    Caution: Contents may have been coded under pressure.