in reply to regexp to check if file name matches pattern

Perhaps this:

/^SYS(?:[^%]+%)+[^.]*\.pdf/i

Matches SYS followed by any non % character(s) that are followed by a % (can be repeated), followed by just about anything except a dot (.) (that's where the date field goes), followed by dot pdf.

Update: /i added, because when I see SYS and .pdf (upper, and lower) I start thinking that case probably shouldn't be allowed to foul up a match.


Dave

Replies are listed 'Best First'.
Re^2: regexp to check if file name matches pattern
by smanicka (Scribe) on Feb 24, 2009 at 22:11 UTC
    the systemblahblah can contain a period unfortunately

      I didn't preclude the dot from "systemblah%blah%", I precluded dot from the datestamp. Did you try it yet? There may be other errors, but that one isn't. ;)


      Dave