Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible editor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-05-12 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (127 votes). Check out past polls.

    Notices?