A mini knowledge base to kick off your not-so-scary learning journey with regular expression aka regex.
- A summary of the Regex 101 module from regexlearn
- Self-collection of regex patterns
- Regex for productivity hacks
📌 Note: Regex is easier to write but harder to make sense. So, keep a handy cheat-sheet and make a habit of going through random regex patterns and try to describe them
Module outline (based on regexlearn.com
):
⚠ Outline with topic file links to be added later
My collection of regex patterns:
Serial | Task | Regex |
---|---|---|
1 | URL Matching | Example |
2 | Convert to CSV | Example |
-
Use Regex-101 as a reference for the concepts regarding regular expressions
- Examples follow three column structure:
| Input file | regex | matched text |
- Examples follow three column structure:
-
Check the Regex for Productivity collection for reuse or tweak it to your own need.
- To run through Git Bash on Windows, execute
$ grep -oP <REGEX> <FILE>
- Options:
-o
show only the matches, not entire lines-P
enables interpretation of PCRE (Perl Compatible Regular Expressions)
- To run through Git Bash on Windows, execute