Hello!
This is a Regular Expressions or Regex tutorial, focused on summarizing and breaking down a regex function's syntax in order to understand how it is used to search through text.
The Regular Expression that will be dissected further in this tutorial is /\d{3}[ -]?\d{3}[ -]?\d{4}/gm which checks/validates for phone numbers in text. Here, the syntax will be used check the text for any phone numbers by the three groups created using "\d" which is a metacharacter that stands for digit 0-9. These groups may be seperated by either a whitespace or a dash which is why we see "[ -]?" in the regex function. This is included because a user can enter a phone number in the text using either a dash, whitespace, or no space in between the groups of numbers. The first group and second group are supposed to match 3 digits in a row with with either whitespace, dash, or no space between each group if present, while the last group matches 4 digits in a row only.