Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Risks in the oblivious use of qr// (warn)

by tye (Sage)
on Aug 11, 2003 at 17:52 UTC ( [id://282958]=note: print w/replies, xml ) Need Help??


in reply to Risks in the oblivious use of qr//

I think the best solution would be to warn when useless quantifiers are specified. (And, having formed this opinion, it is starting to sound familiar and I think I formed this same opinion the last time this came up.)

That is, /(?-i:hello)/i under -w should complain about something like "regex qualifier i applies to nothing and is ignored" (I hope someone can wordsmith that a bit) while /(?m-x:hi(?-m:lo))/x would complain twice. While /(?i:hi)/i would not complain.

Note that whether the ignoring of the flag has a practical impact is not important -- the warning is that conflicting flags caused flags to be ignored, not whether the flags had or would have had any effect on the regex parts they (would have) applied to.

                - tye

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found