Let’s continue reviewing all special regex characters.
Parentheses
Parentheses in regex define a group of characters. For example, (gmail)
will match a string that contains gmail. I know what you’re thinking: “Hold on a sec, isn’t it exactly what a normal regex would do?”
Yes, buuuut groups allow us to apply other special characters too them: (gmail)?
will stand for 0 or no “gmail”.
Groups are extremely useful, they allow us to target multiple search patterns within a single regex. For example, with the regex (foo)(bar)
we can manipulate both...