Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://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,

Let’s 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":



  • 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 janitor 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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found