Check the validity of a 10-digit telephone number Your task is to write a program or function that checks if a string is a valid phone number.

Given a string (or list of characters/codepoints) input, you will output a truthy value if the input is a valid phone number. If it is not, output a falsey value. An input string is considered a valid phone number for this challenge if it meets all of these criteria:


It contains ten digits, which are grouped like this: ###-###-####
The strings separating the digit groups must be the same
The first and last characters must be part of the phone number (i.e. must not be part of a separator)


Test cases:

111-222-3333     truthy
123-456-7890     truthy (number groups can contain different numbers)
1112223333       truthy (can have 0 length separators)
111022203333     falsey (has more than 10 numbers)
111ABC222ABC3333 truthy (can have length&gt;1 separators)
111-222_3333     falsey (non-matching separators)
111-22-23333     falsey (missing digit in middle group)
111--222--33333  falsey (extra digit in last group)
-111-222-3333    falsey (first character is not part of number)
111-222-3333a    falsey (last character is not part of number)
aaa-aaa-aaaa     falsey (not enough numbers)
11-2222-3333     falsey (wrong separator location)
111-1-222-1-3333 falsey (too many numbers)


This is a code golf challenge, shortest answer per language wins.
APL (Dyalog Unicode), 30 29 bytesSBCS



'^\d{3}(\D*)\d{3}\1\d{4}$'⎕S⍬


It simply ⎕Searches for the PCRE regex and returns a dummy value (the empty numeric list) for each match. If none are found, it returns a single empty numeric list.

Try it online! The effect of printing a list of empty lists is to print two spaces on a line, while the effect of printing an empty list is to print an empty line. Select all contents in the Output field to reveal the spaces, or use this to lead each printed line with → and each space with ·.