The regular expression in question is
(\\d{3,4}[.-]?)+
sample text
707-7019-789
My progress so far
<The brackets remove the functionality of the dot. Brackets mean "Range"/"Character class". Thus you are saying Choose from the list/range/character class .- You aren't saying choose from the list "anything"- (anything is the regular meaning of .)
[.-]?
What this means literally:
[.-]
.
and -
literally.?
.
in a character group []
is just a literal .
, it does not have the special meaning "anything". [.-]?
means "a dot or a hyphen or nothing", because the entire group is made optional with the ?
.