In my post about using regular expressions to find matches in a text file, I promised to tell you about the two applications I used to help me write my regex. By the way, Regex is what the cool kids call Regular Expressions.
Let’s state the problem to be solved first. If you have a text file where you want to change something that’s repeated throughout the file, it’s pretty easy to do a search/change all. We do it all the time in text editors. But what if you have a text file that is repeatedly generated and always has the same thing wrong with it? Maybe it’s a date in the wrong format. Or maybe an online system hasn’t been updated with your new company name. Or what if instead of changing the text, you just need to know what the text actually says? Let’s say it’s a date in a document and you want to write a script to change the name of the document to include the date? All of these examples are a great place to try out regex.