I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: (123) 456-7890 or 123-
try this
/^[\+]?\d{2,}?[(]?\d{2,}[)]?[-\s\.]?\d{2,}?[-\s\.]?\d{2,}[-\s\.]?\d{0,9}$/im
valid formats: