diff --git a/modules/qualifying/learning_regex.md b/modules/qualifying/learning_regex.md index fc84437..fbe2959 100644 --- a/modules/qualifying/learning_regex.md +++ b/modules/qualifying/learning_regex.md @@ -94,7 +94,7 @@ Let's break it down a bit: * `.*` matches almost any character as many times as we want In the above pattern you see *two* different forms of character classes, the `[A-Z]` and the `[[:alnum:]]`. -Worth noting is that you can negate an expansion by putting a `^` inside it as such `grep '^[^A-Z].*' regex_03.txt` (not I used the first list because the animals list has no words starting with a capital letter). +Worth noting is that you can negate an expansion by putting a `^` inside it as such `grep '^[^A-Z].*' regex_03.txt` (note I used the first list because the animals list has no words starting with a capital letter). This is basically the same as `grep '^[a-z].*' regex_03.txt`. ### The backslash character and special expressions @@ -114,12 +114,23 @@ let's break this one down. ## Beyond basic -TODO +The tests done above are a quick introduction to what regex are and how to read them. +To master them there are only two things you need to do. + +1. use them +2. google + +There is just no other way to wrap your head around it. +You should see it as a puzzle you're trying to solve. +To get you started I urge you to go to [this](http://regextutorials.com/) website and start the **introduction to regex** section. +It highlights automatically what your pattern is doing. +Once you completed the introduction you should try their exercises and the ones I made for you below. ## Exercises Below are some practical exercises and files to go with them. Use them to test out you grepping skills and as inspiration for personal challenges. +I've tested all of the challenges myself but there are a lot of different ways to get the same result with a different regex. * configuration [file](./assets/sysctl.conf) * print only lines with actual configuration settings (ignore comments and empty lines) @@ -140,6 +151,3 @@ Use them to test out you grepping skills and as inspiration for personal challen * extract all web links * only the base link (https://www.example.co.uk) * both http and https links - -There are some very good regex exercises online as well. -[This](http://regextutorials.com/) is a good starting point.