For that kind of student, I like to introduce them in three stages, leaving out fancy stuff like extended constructs.

  1. literal matches, easy for everyone
  2. builtin character classes and escaped characters, give them a little power
  3. user character classes and anchors, separate the sheep from the goats

The omission of alternation is intentional. Unsophisticated users overuse them and can easily land themselves in a computational tarpit.

The postgraduate course is to point out some of the other things possible and refer to perlretut and perlre.

The key is to show them new things that are useful to them right away. Don't demand big conceptual leaps without motivation, and allow them to practice before demanding another.

An editor which does incremental regex searches with highlighting is valuable for illustrating how regexen work, live. Emacs incremental search is documented in info emacs Incremental Search. Vim documents its version in the "pattern.txt" manual chapter.

After Compline,
Zaxo


In reply to Re: Training non-programmers in Perl regexps by Zaxo
in thread Training non-programmers in Perl regexps by young_stu

Title:
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, details, 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, summary, 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.