http://www.perlmonks.org?node_id=42330

As a supplement to the "7 Stages of a Perl Programmer", I present the 7 Stages of Regex Users (as pertains to Perl's special flavor of regexes):

7 Stages of a Regex User

  1. Novice
    • thinks regular expressions are line noise
    • falls prey to "m/usr/bin/" (embedded /'s in m//)
    • has no idea what tr/// is
    • doesn't know about the i modifier
    • gratuitous use of $`, $&, and $'
    • doesn't use \w, \d, \s, etc. metaclasses
    • painfully misuses * and .*
    • puts words in character classes

  2. Initiate
    • still a victim of leaning toothpick syndrome (LTS)
    • uses regexes where chop() or substr() or index() would do
    • tries to use tr/// like s///
    • uses brackets in tr///
    • uses modifiers needlessly (like o, s, and m)
    • does ($x,$y) = ($1,$2), instead of ($x,$y) = /(re)g(ex)/
    • uses | in character classes for alternation
    • uses [^\w] instead of \W
    • tries to delete HTML tags with s/<.*>//g or s/<.*?>//g
    • backslashes needlessly

  3. User
    • uses different m// and s/// delimiters
    • uses regex where index() would do
    • knows about tr///, but uses s/// instead
    • uses regexes in conditionals
    • knows to use the o modifier, but sometimes gets bitten
    • uses backreferences incorrectly sometimes (\1 on the RHS of s///)
    • starts to understand why HTML tags are hard to match with regexes

  4. Adept
    • knows when to use regexes, and when to use string functions
    • knows when to use tr///, and when to use s///
    • leaves the m off // regexes
    • uses the e modifier in s///
    • toys with look-ahead
    • knows to use (?:...) when a backref isn't needed
    • uses precompiled regexes with qr//

  5. Hacker
    • uses look-ahead and look-behind with impunity
    • sighs at the constant-width restraint on look-behind
    • plays with pos() and \G and the g and c modifiers
    • has read "Mastering Regular Expressions"
    • knows how to "unroll the loop"
    • uses re -- and understands the debug output
    • uses closures to make regex matching objects
    • makes nested regexes using (??{...})
    • can read a regex and explain its function

  6. Guru
    • works on the regex engine
    • has patched the engine from time to time
    • uses precompiled regexes as objects
    • refers to "Henry" (that is, Henry Spencer)
    • can explain how any given regex will or won't work

  7. Wizard
    • can add features to the engine at a whim
    • has pumpking status



japhy -- Perl and Regex Hacker