« Home | 10 things every Perl hacker know » 

Sunday, May 28, 2006 

10. Regular expressions are your friends


Perl's regular expression syntax can help to make your source code look intimidating to the uninitiated, and as a result sometimes people new to Perl programming avoid regexen. This is, really, a mistake. Regular expressions add a great deal of power to the Perl programming language, often allowing the programmer to do something in three lines that might otherwise take fifty lines of code. Regular expressions are expressions made up of abbreviations for matching patterns in strings that can be used to find and manipulate smaller strings inside larger strings. It behooves the Perl hacker to learn regex syntax and learn it well.


--------------------------------------------------------------------------------

Often Perl hackers and other programmers who use regular expressions will refer to them as "regexen" or "regexes" in the plural ("regex" singular). An alternate version of "regex" is "regexp", though why anyone would want to add that extra letter, making it more difficult to pronounce clearly, is beyond me.