In this tutorial we will be taking a dive into Regex. Regex, or regular expressions, are patterns that are used to search for character combinations in strings. They are used by string-searching algorithms and for matching input validation.
Today we are going to be taking a look how to implement a regex to verify that a phone number is valid:
/(?:(\+1)[ -]?)?\(?(\d{3})\)?[ -]?(\d{3})[ -]?(\d{4})/