Previous slide Next slide Back to the first slide View text version


Notes:

This slide is a summarization from the O’Reilly book sed and awk.

This is an accurate description in describing the process of debugging or fine tuning regular expressions. Testing ensures your regular expression works as expected!

In the evaluation process you want to eliminate the hits that should be misses and misses that should be hits first! This approach minimizes the number of passes to have your expression accurately defined. Eventually you will be determine correctness of your pattern match. Consider the previous examples that have illustrated this process.

Just like any form of programming, nothing is full proof! The method described here is an excellent technique for debugging and refining regular expressions. Don’t forget to archive your regular expressions (especially the complex/tedious ones); regardless of the frequency that the expression is used. You never know if you will need it again or have an equivalent pattern match.

Coding Techniques

Writing regular expressions requires three steps:

These three steps are very similar to the fundamental of the programming process; involving creating algorithms, coding, and debugging. There will be times when the expressions will have logic flaws. When this happens refine the code by improving the logic in the regular expression.