A regular expression is a string used to match a set of strings according to a certain syntax. Although not easy for beginners, it is worthwhile learning the expressions as they can be a huge time-saver when having to modify data. Say you have a list of friends in a file whose surname is followed by a comma then a space, finally followed by the first name:
Doe, John Public, Jane ...
If you need the list as “Firstname Surname”, a simple substitution in vi or sed can make your day:
:%s/^\\(.*\\), \\(.*\\)/\\2 \\1/
I’ll admit that looks a bit wild. ;-) A tutorial might help a bit, as will the excellent cheat sheet which you can print out and keep on your desk. Why learn regular expressions? Because they are used in all good text editors, including such gems as Notepad2 for Windows, and because a lot of programs in Unix/Linux use regular expressions. Apache uses RE in some of its configuration files as do the Exim MTA and OpenLDAP’s slapd. If you need to use regular expressions programatically, the routines regex or regcomp will help you embed regular expressions into your code. And finally, via die ContentSchmiede comes a pointer to the Regex Evaluator in German.