Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Making a regex case insensitive

by Win (Novice)
on Mar 06, 2007 at 18:13 UTC ( #603475=perlquestion: print w/replies, xml ) Need Help??

Win has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Making a regex case insensitive
by ikegami (Patriarch) on Mar 06, 2007 at 18:18 UTC

    There's a modifier for regexp that makes it case-insensitive.

    By the way, if you're trying to prevent the users from making changes to the database, why don't you revoke the relevant rights from your database user?

    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Making a regex case insensitive
by Moron (Curate) on Mar 07, 2007 at 13:49 UTC
    Once upon a time this was a sensible question. Character sets such as EBCDIC and ASCII were designed so that everything could be shifted or unshifted by unsetting or setting a bit in the binary code. For example, in the original ASCII, unsetting the 32 bit not only shifts from 'a' to 'A', but also from ';' to '['. Unfortunately it is unclear why it happened, whether the ASCII convention itself contains not even a single technical provision (just a long featureless vomit of impreganable legalese) or because the whole idea got overlooked when a plethora of nastily unpredictable keyboards started arriving in front of us intended to support different languages or whatever (just an excuse for incompetence - there was no need to botch ASCII). Nor is it clear whether the technical standards behind ASCII (probably an IEEE standard actually) was just Microshafted and/or IBuMmered as well, but suffice to say the concept of a shift key got severely corrupted with total loss of consistency and Perl, which came to be after the Great IBM/Microsoft Disaster had only the bare bones left to pick through, hence the whole concept of case for Perl being limited to alpha only.

    Update: actually in a way the ASCII ctrl key survived more than the shift key! (for example CTRL-C is "C" with the 64 bit unset = ascii 3) and that is more consistently implemented on keyboards, probably because the hordes of typists from all over the world didn't actually use it to type a letter on IBM word processors, so it remained unIBuMerred until it was later Microshafted: I.e. in another sense it didn't, for example, CTRL-C (ascii-cancel) while surviving to some extent on Unix and Linux won't work the same way under Windows. Unfortunately, the ASCII ctrl key is partially impaired on *Nix owing to the attempt to make e.g. Open Office transparent for the ex-Windows user. (ALT-C would have been a better idea for "copy" in regard to preserving the existing standards for keyboards).


    Free your mind

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://603475]
Approved by ikegami
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-10-03 20:29 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (15 votes). Check out past polls.