Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
We don't bite newbies here... much
 
PerlMonks  

Re: String manipulation

by AnomalousMonk (Monsignor)
on Dec 15, 2012 at 13:42 UTC ( #1008983=note: print w/ replies, xml ) Need Help??


in reply to String manipulation

What the heck. Another approach:

>perl -wMstrict -le "my @dates = ( 'December 1st 2012', 'December 2nd 2012', 'December 23rd 2012', 'December 24th 2012', 'December 765th 2012', 'an 8th note', ); ;; for my $date (@dates) { printf qq{'$date' -> }; $date =~ s{ \d \K (?: st | nd | rd | th) \b }{}xms; print qq{'$date'} } " 'December 1st 2012' -> 'December 1 2012' 'December 2nd 2012' -> 'December 2 2012' 'December 23rd 2012' -> 'December 23 2012' 'December 24th 2012' -> 'December 24 2012' 'December 765th 2012' -> 'December 765 2012' 'an 8th note' -> 'an 8 note'


Comment on Re: String manipulation
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-04-21 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls