Appendix: Regular Expressions
Jeff Atwood, the co-founder of StackOverflow.com, is a big fan of regular expressions. On a shortlist of his mandatory readings for software engineering is the Regular Expression Cookbook, and this is what he says:
I may be a card carrying member of the “Keep It Simple Stupid” club, but I’m making a meteor sized exception for regular expressions. Written properly, they will save you a tremendous amount of time in string manipulation, and I’ve never run across a project where they didn’t come in handy somewhere.
Once you delve into the world of regular expressions, you may become drunk with the amazing power and potential they have, which results in things like Perl. Remember, absolute power corrupts absolutely. But it also rocks absolutely.
You cannot efficiently use Sokrates if you do not know at least the basics of regular expressions. Sokrates uses regular expressions for two purposes: to filter and classify files, extract and manipulate text, name components, or identify dependencies.
Regular Expressions in Sokrates
Sokrates is all about regular expressions. Sokrates is inspired by grep, a command-line tool for searching text data sets for lines that match a regular expression. Its name comes from the ed command g/re/p (globally search for a regular expression and print matching lines). grep was originally developed for the Unix operating system, but later available for all Unix-like systems and some others.
Sokrates uses regular expressions for two main purposes:
- Filter and classify files (see the Scoping section for details), and
- Regular expressions as a part of Sokrates String Transformation Language (SSTL). You can use SSTL to define the names of components and identify dependencies among the components.