Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: RegEx Headaches

by oryx3 (Novice)
on Jun 19, 2013 at 18:46 UTC ( [id://1039824]=note: print w/replies, xml ) Need Help??


in reply to Re: RegEx Headaches
in thread RegEx Headaches

Yes, you answered the question correctly. Unfortunately, it was the wrong question. (That's my fault, not yours.)

I should have added: the filename can have _one or more_ digit groups separated by periods in the middle. I want to extract them ALL!

So, for example:

ActionLogs.1.2.3.4.5.6.7.8.9.xml

Should yield

0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9

I thought the g would do that, but I guess not.

Replies are listed 'Best First'.
Re^3: RegEx Headaches
by farang (Chaplain) on Jun 19, 2013 at 23:57 UTC

    One way to do it.

    DB<1> $_ = 'ActionLogs.1.2.3.4.5.6.7.8.9.xml' DB<2> x split ' ', tr/.[a-zA-Z]/ /dr 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 DB<3>

    Update: The brackets are unnecessary; tr/.a-zA-Z/ /dr works just as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found