Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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.
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

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 surveying the Monastery: (3)
    As of 2020-09-20 12:02 GMT
    Find Nodes?
      Voting Booth?
      If at first I dont succeed, I

      Results (121 votes). Check out past polls.