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

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

    -M

    Free your mind