Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Regex for matching a file name

by shenme (Priest)
on Sep 06, 2004 at 23:57 UTC ( #388886=note: print w/replies, xml ) Need Help??

in reply to Regex for matching a file name

First, you must explicitly limit what the variable name is that is being substituted, e.g.
otherwise you are trying to interpolate variable "$THREADx".

Then you need to make sure the '.' is matching a period. Normally a '.' in an RE is a "match anything" character. So you would need to escape the magic meaning, e.g.

Then you want the "match anything" for "any length" where you had the asterisk, e.g.

And... you might want to make sure you don't match "321xBOOM.htm" by saying the string '1' should come at the start of the string, e.g.

And you might want to wrap it up by checking that the filename _ends_ with the 'htm', e.g.

Let us know if this helps!

Replies are listed 'Best First'.
Re^2: Regex for matching a file name
by Anonymous Monk on Sep 07, 2004 at 01:13 UTC
    Thanks to both you Monks, the code works perfectly!!! I certainly appreciate your fast responses.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2019-12-11 09:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found