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

Re^3: Another Pattern Matching Question

by surib (Initiate)
on Oct 12, 2012 at 17:43 UTC ( #998756=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Another Pattern Matching Question
in thread Another Pattern Matching Question

Or like this: (I've tried so many combinations I'm confusing myself!)

if ($fileName =~ /3B4[0|1|2]RT\.\d{10}\.7R.bin/) { ($product, $year, $month, $day, $hour, $ver) = ($fileName =~ /(3B4.RT)\.(\d{4})(\d\d)(\d\d)(\d\d)\.(7R)\.bin/); $version = sprintf "%03d", $ver; # a little confusing, $version +is global # $ver is local

Comment on Re^3: Another Pattern Matching Question
Download Code
Replies are listed 'Best First'.
Re^4: Another Pattern Matching Question
by runrig (Abbot) on Oct 12, 2012 at 17:50 UTC
    If you just want to match 0,1, or 2 and not "|", then your character class should be [012], not [0|1|2].

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2015-11-30 23:43 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (788 votes), past polls