Home | Notes | Github |
---|
Written: 05-Mar-2022
This is just a short article explaining regex to keep the cheat sheet de-cluttered.
It allows for easy text parsing. Ask your local friendly search engine for more info
The gist is it looks through an input string (or file) and identifies matches with the search expression The search expression can be as simple as a word, or more complex. The cheat-sheet explains the basics, and enables you to build up more complex search patterns.
This basic (made up) example would find the word “color” (as it’s a common misspelling1) in a text file about paintings:
grep "color" "painting.txt"
grep
is short for “get regular expression”2.
Matching patterns allows you to then modify the text (using a command like sed
) or to single out specific points of interest (like file names using find . -regex
).
To learn it, try creating search patterns using the cheat sheet, and testing them in the terminal or online.
That’s all the little things I’ve got. Look at the cheat-sheets if you’re still curious: