Learn Regex the Easy Way, Part 6: Alternation and Grouping

Quick Recap # In Part 5 , we covered metacharacters, escaping with backslash, and the dot wildcard. We learned the 14 special characters and how to match them literally. Now let’s combine patterns with “or” logic and control what our quantifiers apply to. The Pipe Means OR # The pipe character | means “or” in regex. cat|dog matches either “cat” or “dog.” Grouping with Parentheses # Here’s where it…