$a = "result01182006.xml";
$a =~ /^(result)(\d{2})(\d{2})(\d{4})/;
print "$1 $2 $3 $4\n";
In the contents of this file i I need to replace every instance of
1/7/2006 to 01/18/2006.
Change the date of "Sat 07 Jan 2006" to corresponding day which
01/18/2006 falls on, so it should be changed to "Wed 18 Jan 2006
and change the string result01072006 to result01182006
Please can somebody help here.. Working on no sleep whatsover in 24
hrs.
Sibi
http://tinyurl.com/ryucn
http://tinyurl.com/ohy3g
http://tinyurl.com/q234q
Multiposting is universally considered rude in usenet. Folks are
unlikely to help you if you do not abide by basic rules of usenet
courtesy.
--
David Filmer (http://DavidFilmer.com)
> Multiposting is universally considered rude in usenet.
Wrong.
There is never ever anything universal about usenet.
> Folks are unlikely to help you if you do not
> abide by basic rules of usenet courtesy.
How odd that so many multiposts get replys.
There are Perl newsgroups, FAQs, loads of website and mailing lists.
Lots of Perl examples from the above sources deal with regex and dates.
>I have a file name result01182006.xml which is named according to the
>date. I know how to split it to get the values
>
>$a = "result01182006.xml";
>$a =~ /^(result)(\d{2})(\d{2})(\d{4})/;
>print "$1 $2 $3 $4\n";
It's assumed this is an example and you have to change any occurance of
date A to date B and not only 1/7/2006 to 01/18/2006?
Because if it'a single date A to B everywhere and there is no A to C , D
to E swaps then you don't have to do anything beyond a simple replace.
Same goes for Sat 07 Jan 2006 to Wed 19 Jan 2006 it's a simple string
replace and you don't need to look up the Sat to Wed conversion.
>In the contents of this file i I need to replace every instance of
>1/7/2006 to 01/18/2006.
>
>Change the date of "Sat 07 Jan 2006" to corresponding day which
>01/18/2006 falls on, so it should be changed to "Wed 18 Jan 2006
>
>and change the string result01072006 to result01182006
>
>Please can somebody help here.. Working on no sleep whatsover in 24
>hrs.
So is what is your problem -
Modifying files?
The algorithm to lookup / replace text?
A calendar module you can lookup the translation for Sat to Wed?
>Sibi
Me