Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: string match using with an N in any position

by bart (Canon)
on Nov 22, 2011 at 18:00 UTC ( #939508=note: print w/ replies, xml ) Need Help??


in reply to Re^3: string match using with an N in any position
in thread string match using with an N in any position

Here's another idea: Regexp::Assemble is a module that can combine regexps — and possibly optimize the result. Granted, nowadays perl already optimizes large regexps, so it's not as useful any more as it once was.

Turning a glob pattern into a regexp isn't that hard: you can already get far by replacing every "?" with ".", "*" with ".*", and quotemeta everything else.

%s = ( '?' => '.', '*' => '.*' ); s/(\W)/$s{$1} || "\\$1"/ge;


Comment on Re^4: string match using with an N in any position
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-09-17 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls