Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: String manipulation

by AnomalousMonk (Archbishop)
on Dec 15, 2012 at 13:42 UTC ( [id://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'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found