This will not work (the . will match the /'s and preface them with 
0's)... try \d instead:

$ perl -e '$a="9/9/1973\n";$a=~s/\b(.)\b/0$1/g;print $a;'
090/090/1973
$ perl -e '$a="9/9/1973\n";$a=~s/\b(\d)\b/0$1/g;print $a;'
09/09/1973
$ perl -e '$a="9/09/1973\n";$a=~s/\b(\d)\b/0$1/g;print $a;'
09/09/1973

I would use printf's, tho, even tho I love regexps. :)

Jason

----- Original Message ----- 
From: "Paul Makepeace" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 31, 2002 8:47 PM
Subject: Re: substitution question


> On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote:
> > Thanks but I am looking of any regexp substitution.
> > 
> > sorry for typo : I need to change 9/9/1973 to 09/09/1973
> 
> How about,
> 
> s/\b(.)\b/0$1/g
> 
> Paul
> 

Reply via email to