Fairly new to ruby so sorry if it's an easy solve.
I want to verify a 10 digit phone number regardless of formatting using Regex. The function contains a conditional however I think it can be simplified.
eg:
valid_phone = ["2438894546", "(718)891-1313", "234 435 9978", "(800)4261134"]
invalid_phone = ["28894546", "(718)891-13135", "234 43 9978"]
def valid_phone_number?(phone)
number = phone.scan(/\d/)
number.length == 10 ? true: false
end
How do we count the arguments digits regardless of the special characters?