in reply to Re: phone number regex
in thread phone number regex

That works great!! A few questions on this. Every time I run this, I get the number 000-000-0000 on the top of my list even though it's not in my file. Any idea why?

Also, can you explain what the sprtinf line is doing? I know sprintf does something with numbers but I don't see what this is actually doing. This matches MORE than 10 characters if you find numbers like 123.231.343.343 it would match the ending 343 as well, so I it's not telling how many numbers to match.

Thanks.

Replies are listed 'Best First'.
Re: Re: Re: phone number regex
by Mr. Muskrat (Canon) on Mar 11, 2004 at 00:11 UTC

    It's finding a line without any numbers in it. Like I said in my reply to graff, I didn't check the input to see if it matched a phone number.

    The sprintf is creating a string that is a minimum of ten digits long and that is zero padded if the number is less than ten digits. "123.231.343.343" would become "123-231-343343" in the end.