Re: a regex question ..
- From: Elvis Cehajic <lists@xxxxxxxx>
- Date: Sat, 30 Apr 2005 19:49:31 +0200
Hi
Fabian Pilkowski wrote:
Yes, it isn't. Try to use s/// instead.
my $name = 'aaa2bbb3'; ( my $newname = $name ) =~ s/(\d)/0$1/g; # results in: $newname = 'aaa02bbb03'
Just keep in mind that this will change 'aaa11bbb12' to 'aaa0101bbb0102' which is probably not what the OP wants. But right now i can't think of a solution myself...
Be aware of the /g-modifier at the end of s///. Read `perldoc perlop` to
learn more about this substitution operator.
regards,
fabian
Elvis
-- Elvis Cehajic http://www.nihil.ch
perl -e '$_="(o_\n//\\\x0AV_/_\x20\u\x6C\x69\x6E\x75\x78\n";print' .
- Follow-Ups:
- Re: a regex question ..
- From: Gunnar Hjalmarsson
- Re: a regex question ..
- References:
- a regex question ..
- From: Geoff Cox
- Re: a regex question ..
- From: Fabian Pilkowski
- a regex question ..
- Prev by Date: Re: a regex question ..
- Next by Date: missing the boat
- Previous by thread: Re: a regex question ..
- Next by thread: Re: a regex question ..
- Index(es):