in reply to Simple Regular Expression Help Needed

Try /^file-15a_62_200405.*?\.txt$/i

  • Comment on Re: Simple Regular Expression Help Needed

Replies are listed 'Best First'.
Re^2: Simple Regular Expression Help Needed
by Tanktalus (Canon) on May 25, 2005 at 13:19 UTC

    Just as a side note here - that ? to make the match non-greedy. You have anchors at both ends (^ $), so greediness shouldn't come into play here. You actually do want to match as much as possible.

    Yeah, I know. Really minor. :-)

      Yep, you're right.  For whatever reason, I had non-backtracking patterns on the brain even though there is nothing in the regex that states it is non-backtracking...  And the $ shouldn't be there, it was a blind copy/paste from OP's code.