From the course: Troubleshooting and Debugging Bash

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing regular expressions

Testing regular expressions - Bash Tutorial

From the course: Troubleshooting and Debugging Bash

Start my 1-month free trial

Testing regular expressions

- [Instructor] Diagramming control flow to test your regular expressions is a helpful way to understand what is happening when you run your script. You can shorten the amount of time you spend debugging your code by testing your regular expressions outside of your script. It's a good troubleshooting step to import a function from an external file. The key to writing a testing script is to break up your script into independent procedures that can be imported into both your running script and your testing script and make your running script as simple as possible. A while loop is a great example of a regular expression. A regular expression searches for a pattern within text. A great example of this is looking for something that looks like an email address in a text file for example. In a while loop, a process runs until some expected content is found or criteria is met. Diagramming your processes can help you to visualize the…

Contents