Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: regexp to check if file name matches pattern

by davido (Cardinal)
on Feb 24, 2009 at 22:07 UTC ( [id://746123]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://746123]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2025-04-20 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.