Re: Simple regex question
- From: John Bokma <john@xxxxxxxxxxxxxxx>
- Date: 27 Nov 2006 23:25:55 GMT
Bryan <b@xxxxxxx> wrote:
Hi,
If I have this:
my $v1 = "9"; #Needs to be "09"
my $v2 = "01"; # Okay
my $v3 = "3"; # Needs to be "03"
my $v4 = "54"; #Okay
I want to make sure that all strings have the same format, which is 2
digits (or more) but that single digit values are padded with a '0'.
This is for a database query that happens later.
What is the regex to convert "1" to "01" and leaves "101" alone?
perldoc -f printf
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
.
- References:
- Simple regex question
- From: Bryan
- Simple regex question
- Prev by Date: Re: Interactive programs & Teeing
- Next by Date: Re: Help improving IO::Socket script response
- Previous by thread: Re: Simple regex question
- Next by thread: Re: Simple regex question
- Index(es):
Relevant Pages
|