Regular expressions or regex are special sets of developer designed code used for pattern matching purposes in strings. Its purpose is useful in constraining the input of the user to the expected characters (letters and numbers), format (such as an email which includes an @ and .), and length, (such as a zip code, social security number, or a specific regional phone number). These patterns of expected output are useful for avoiding instances of SQL injection attacks, corrupted databases, or mismatched data that may cause the program to no longer function as expected. We will be going into detail on a single regex in this gist.
The regex expression we'll be looking at is the expression that parses the information of the input and expects a phone number in return. The expressions original source is from MDN Web Docs describing regular expressions. At the bottom, the following code snippet