Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: String manipulation

by toolic (Chancellor)
on Dec 15, 2012 at 03:28 UTC ( #1008929=note: print w/ replies, xml ) Need Help??


in reply to String manipulation

Another way, borrowing Athanasius' alternation:

use warnings; use strict; while (<DATA>) { s/(\d+)(th|st|nd|rd)/$1/; print; } __DATA__ December 14th 2012 December 21st 2012 December 22nd 2012

See also:


Comment on Re: String manipulation
Download Code
Re^2: String manipulation
by nvivek (Vicar) on Dec 17, 2012 at 05:28 UTC
    Following will solve December 23rd 2012 to December 23 2012. It will work for all 1st, 2nd and 3rd to 1, 2, 3 respectively.
    use warnings; use strict; while (<DATA>) { s/(\d+)([a-z]{2})/$1/; print; } __DATA__ December 14th 2012 December 21st 2012 December 22nd 2012 December 23rd 2012

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-12-19 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (77 votes), past polls