Formatting
Phone numbers are written too many ways for a simple digit grab, and too loosely for a perfect one. This page looks for an optional country code, then a group of two to four digits or a parenthesized group, then two more groups of three or four, with spaces, dots, or hyphens between them. “+1 (212) 555-0199” matches whole. “020 7946 0958” and “+44 20 7946 0958” match whole.
“Odd socks in the dryer.” has no number, so the list is empty. “555-0100” is too short for the three groups and is missed. “ext 12” is missed. Letters in a vanity number are missed. A closing format the pattern does not know, such as digits glued in an unusual split, is missed.
The same looseness creates false hits. “4111 1111 1111 1111” is a card, and the matcher still returns “4111 1111 1111”, dropping the last four because they do not fit another group. Do not treat this list as proof of a phone. Unique matches only collapses exact repeats. It does not check that the number can be dialed.
Call +1 (212) 555-0199 or 555-0100. Card 4111 1111 1111 1111.
+1 (212) 555-0199 4111 1111 1111 555-0100 is missing. The card is partly matched and should not be dialed.
Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.
The pattern wants three groups after an optional country code: two to four digits, then three or four, then three or four. Two groups are not enough.
No. “ext 12” and similar tails are outside the pattern. You get the main number only when the main number itself matched.
It can. Sixteen digits grouped in fours can match the first twelve. Check the list before you treat every line as a phone.
Spaces, dots, and hyphens between groups, and parentheses around a two-to-four digit group. “+1 (212) 555-0199” is the shape the pattern was written for.
No. Only digits, separators, parentheses, and a leading plus are part of a match. A vanity word breaks it.