Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
brusimm, this seems a good start; even meritorious!

      ...sufficiently so that I hope I will not offend with observations on a few things that seem to me to be shortcomings. So, if you care,

You seem to be a bit categorical when, even in the context framed by your RFC, you might do better to qualify remarks. For example,

"Patterns are used to locate text strings within text lines."
... to which I say, 'yep, but also across line-endings and not necessarily only for what the target audience might consider a "text string"

I would urge great care in language in comments, as well. For example, in "example 1"

004:   print "There, brus showed up.\n" ; # if the pattern is found, print it!
You mileage may vary, but I read the comment as at least mildly MISleading because of what I see as potential confusion on the reader's part between the hardcoded output "brus showed up" and the captured "brus"

BTW, here or, at latest, the next section might be the time, despite the added complexity entailed, to introduce the wisdom of testing whether a match actually DID succeed.

# Possible revision, example 1 $_ = "I logged in as brusimm and found that I had email."; # Test s +tring if (/brus/) { # Patter +n: brus print "There, our pattern showed up in our string.\n" ; # Tell u +ser } else { print "No match in our string for our pattern.\n"; # As you +'ll see... }
where the truncated comment might be used to foreshadow a later segment of your tut that demonstrates the dangers of using a presumed but untested match.

I hold (again, YMMV) that economy of language helps the reader to understand.

Hence, IMO,

Lets say we knew whoever wrote the line, had issues with typing, for example, I had too much coffee and wrote the following:
might better be phrased (trying not to impose too much of a nitpicker's editor's judgement on your bid to be "user friendly):"
Let's say I'd had too much coffee, and might have mis-typed the test string.

I'd also urge greater care (or, perhaps, selectivity) in language such as:

Notice the control character of s before the forward slash. Check it out with this script:

001: # example 3
002: #
003: $_ = "I logged into bruuuusimm and saw I had email.\n"; # original error
004: print $_ ; # printing proof of error
005: if (s/bru*s/brus/) { # fixing it
006: ....

While your reference to the "s" before the slash as a "control character" is arguably CORRECT, as a tutor you may want to consider your audience's preconceptions/prior knowledge/frame of reference. Many who are new to regexen may have sufficient computer experience to simply slide over a semi-familiar phrase, confident in a preconception that a "control character" is a byte in the range 0-0x20; something quite different than what you intend.

I could go on a bit more, but perhaps this is a better time to simply offer the thoughts that:
1. Very few are their own best editors.
            and,
2. Work with someone whose language skills rival your coding skills.


In reply to Re: RFC - Regular Expressions Tutorial, the Basics (for BEGINNERS) by ww
in thread Regular Expressions Tutorial, the Basics (for BEGINNERS) by brusimm

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    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 exploiting the Monastery: (6)
    As of 2014-11-01 07:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (228 votes), past polls