Regex stands for regular expression. It's a sequence of characters that specifies a search pattern, used for finding, removing, or replacing parts of a spring. The benefits of regex is that it's versatile, and can be used in applications like Tableau and Alteryx.
This blog will go over the basics of Regex, giving a high-level overview for beginners and examples.
Aspects of Regex
Character class (qualifiers)
Character class are what's being searched for.
For example:
\w -> means that I'm searching for alphanumeric
\l -> means that I'm searching for lowercase
\d -> means that I'm searching for digit(s)
Quantifier
Quantifiers denote how many times the character can be seen.
For example:
* -> means match zero or more; Greedy
+ -> means match one or more; Greedy
{x} -> means match exactly {x} amount (i.e., \w{3} would return 3 alphanumeric chunks)
Special characters
Special characters are characters that have a specific meaning, reserved for that purpose.
The special characters in Regex are:
.[]{}()\*+?|^$
For example, the period is a wildcard, meaning it'll return any character, and the $ returns the end of an anchor.
For special characters to be used literally, a backslash is necessary. So, while . on it's own is a wildcard, \. will search for the appearance of the period.
Examples
I'll be using https://regex101.com/ to be walking through examples.
Task: I want just the bubble tea flavors that my team has ordered.
Here's the string:
Skyla - Brown sugar milk tea
John - Thai milk tea
Tiarra - Taro slushie
Bob - Oolong with no ice
Fredrick - Strawberry matcha with cold foam
To get only the order, I know I only want items after the hyphen and the space. Here's an expression I can use for that: -\s(.+\S)\s

To explain this expression, here the parenthesis are grouping whatever is after the hyphen and the space, while leaving out the trailing space afterward. That was possible thanks to \S meaning not a space, and that being included in the grouping.
Task: I want the addressed mentioned
Here's the string:
On 3355 Street Madeup Avenue my grandma's neighbor Sara lives with her grandson Bill, and they don't like Pal down the street at 7575 Street Imaginary Avenue
In this situation, I know that there's always 4 numbers, then the word street, the avenue name, and the word avenue. Thanks to that, the following expression works: \d{4}\s\w*\s\w*\s\w*

This captures the three words after the initial four digits.
I hope this blog helped you understand Regex better. Good luck!
