Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to 7 Stages of Regex Users by japhy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (5)
    As of 2021-04-13 15:50 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found