Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Regex partial/leading match

by RichardK (Parson)
on Dec 31, 2015 at 23:37 UTC ( #1151646=note: print w/replies, xml ) Need Help??

in reply to Re^2: Regex partial/leading match
in thread Regex partial/leading match

Part of your problem here, is that you have more information than you're giving the computer. i.e. they're not just regex but file system path expressions.

You might take advantage of that knowledge and decompose the regex into a set of File::Find::Rule rules, obviously you'll have to write the parser youself, but hopefully all the regexes will be quite similar and there will be common patterns that you can spot and translate into rules.

So you might end up with something like :-

my @dirs = File::Find::Rule->directory()->name(qr/blah[0-9]/)->in(' +C:\\Windows\\Program Files'); my @files = File::Find::Rule->file()->name('setup.exe')->in(@dirs);

It's an interesting problem and well worth spending some time on.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2020-06-03 12:50 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (23 votes). Check out past polls.