Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: regexp wizardry needed

by LanX (Chancellor)
on Jan 25, 2013 at 18:50 UTC ( #1015389=note: print w/replies, xml ) Need Help??


in reply to Re: regexp wizardry needed
in thread regexp wizardry needed

Still no clear question, only a bunch of weird code! :(

That's what you want?

DB<159> @date = (" PERIOD 13 OCT 06 OCT" =~ m/ PERIOD (\d\d) (\w\w\w +) (\d\d) (\w\w\w)/) => (13, "OCT", "06", "OCT")

If you only need the first letter of the month to be capitalized, try only matching the first letter and the rest, and process them accordingly with lc() or '\U' and '\L' in s///ubstitutions.

UPDATE
another way to do it, see ucfirst() (a command I've never used before =)...
DB<164> ucfirst lc $date[1] => "Oct"

Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015389]
help
Chatterbox?
[Corion]: Heh. Perl heredocs are nasty - Filter::Simple doesn't know whether the line continued after the heredoc or not. The heredoc payload starts on the next line.
[Corion]: So currently, Filter::Simple mangles your code/line numbers if you use heredocs ;)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-01-22 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (187 votes). Check out past polls.