in reply to Capitalization and Regex

I'm a little fuzzy on what you're asking, but it sounds like you want to match case-insensitively, or perhaps, convert from mixed-case to all one-case.

I think you might want to look at the /i regular expression modifier, explained in perlretut and perlre, or the uc and lc functions, explained in perlfunc.

You can change the capitalization in portions of strings with the \l and \u metacharacters (for one char at a time) or the \L, \U, and \E metacharacters (for altering the case of chunks of characters). These are also described in detail in perlretut.

Update: Thanks Anonymous Monk for finding a more accurate way to express my thought. I've corrected the verbage.


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein

Replies are listed 'Best First'.
Re: Re: Capitalization and Regex
by Anonymous Monk on Oct 26, 2003 at 22:21 UTC
    If you need only part of the RE to work case-insensitively, look at the \l and \u metacharacters (for one char at a time) or the \L, \U, and \E metacharacters (for altering the case of chunks of characters). These are also described in detail in perlretut.
    I don't think those help in making portions of RE's case insensitive, they will change portions of strings to upper or lower case. For case insensitive portions of an RE, use /some(?i:InSensiTIve)portion/
Re: Re: Capitalization and Regex
by Anonymous Monk on Oct 26, 2003 at 22:22 UTC
    Thank you, everyone, for the help. It's back to the Man pages with me. ^_^