in reply to Re: RegEx Help
in thread RegEx Help

++ for the rest, but "wrong" to your final comment:

The /i has no impact with the character class ... but may very well have to do with the "j". If OP was concerned about the various combinations of .jpg, .JPG, Jepg, JPEG and so on, then the /i is, in fact, very much needed.

Updated to clarify the last sentence above

Replies are listed 'Best First'.
Re^3: RegEx Help
by pvaldes (Chaplain) on Dec 19, 2011 at 00:11 UTC

    I didn't see the extension. Welldone, smart note...

    But, although you are pointing in the right way, in this particular case could be a false problem...

    Remember, this is what we are really feeding to the script.

    @Files =( "filename=merilyn14.jpg.jpeg", "filename=003_Merilyn23.jpg.jpeg", "filename=890FoxyM.jpg.jpeg", "filename=006.jpg.jpeg" );

    At least in some operative systems "filename=merilyn14.jpg.JPEG" will never be evaluated or modified by the regexp, because is not in the foreach loop, so be aware of this point. We can safely avoid /i here if we are in Linux, cause its our duty to check before what we put in @Files, and even if it was one or several JPG we should change only the regexp for those matches. There is not point into having a regexp searching something that we know will never match.

Re^3: RegEx Help
by Anonymous Monk on Dec 20, 2011 at 14:49 UTC
    You say "/i has no impact with the character class". Which in this case is true as the class is [A-Za-z] but is not generally true:
    perl -Mre=debug -e'/[a-z]/i' Compiling REx "[a-z]" Final program: 1: ANYOF[A-Za-z][] (12) 12: END (0) stclass ANYOF[A-Za-z][] minlen 1 Freeing REx: "[a-z]"
      It would probably be well (and maybe even accurate?) to assume that statements in response to a particular node or question are context-sensitive; in other words, that you may wish to read replies as if they include the disclaimer "in this case, YMMV for other cases" or something similar UNLESS the writer has explicitly asserted that the statement is "generally" or "universally" true.

      Or maybe I should just include even more disclaimers. :-(
            or, maybe, ... :-;
      ?