http://www.perlmonks.org?node_id=442813


in reply to Regexp do's and don'ts

muba: good stuff.
You may wish to consider the following (mostly minor and occasionally open to debate) re the idiom or syntax:

In Introduction, "Note: this is not a regex tutorial or regex howto." (emphasis supplied) s/or /nor/

likewise, s/If you may ever find /If you ever find / (may)

Jargon: "Before I finnaly start off, let's set some terminology." -- for spelling change to "finally"; for idiom: just omit it entirely.

Rules of Thumb 2: I'm intruding into content here, but I'm troubled by the statement, "when input from external sources may be unsafe." My view: input from external sources is ALWAYS unsafe... even if it's coming from me. No malice is required: "Fat fingeritis" can wreak havoc!

RoT 2: "...etc) is considered 'tainted'." s/is/are/ for subject-verb agreement in quantity;
typo: "Also, thinks like" s/thinks/things/.

also in RoT 2, for brevity: "There are several ways to untaint data, which I am not about to mention here. You should check the above mentioned Perl Security (perlsec) manpage." could be written, "There are several ways to untaint data for which you should check the above-mentioned...."

RoT3: "They are ignorant or else they are malicious." would be less globally applicable to (all) users) if you said, "Some are ignorant; some are malicious." (As written, the current phrase indicts ALL users.)
and
"...number from 1 to 5, including, you..." s/including/inclusive/
"On the other hand," means (in this useage) that what follows is intended as a counter-example, whereas what actually follows is a supporting or additional example. Suggest one way to improve it would be to drop the quoted phrase, or (and the grammar stiffs will be object to this, replace "OTOH" with "Or"
typo: s/easiliy/easily/

RoT 5. "syntaxis" -- I think you want "syntax" and
"analysis" instead of "analyzing."

RoT 6. spelling: s/shuld/should/

RoT 7. "Do use CGI; (have..." might be clearing if you were to say "Do use CGI:; (have..." or, even better, if you specified the module by its full name
and: "CGI offers you a great amount of functions" can be better phrased "CGI offers you many functions"
and in "...as good as the module's author." s/good/well/ (good is an adjective, well is the adverb form).

If you find these useful (msg me), I'll carry on with the rest of the document.

Again, ++

Replies are listed 'Best First'.
Re^2: [Try-out] Regexp do's and don'ts
by muba (Priest) on Mar 28, 2005 at 21:11 UTC
    Thank you!
    I used all but one of your suggestions to improve this document. Most things you pointed out where stupid mistakes (which I of course fixed), others were things I'd never find out.
    Again, thank you!




    "2b"||!"2b";$$_="the question"
    Besides that, my code is untested unless stated otherwise.
    One more: please review the article about regular expressions (do's and don'ts) I'm working on.