Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 examining the Monastery: (2)
As of 2025-12-07 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (86 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.