in reply to Best way to put : between fields in a string

TIMTOWTDI

my $s = 'A3xyz45M98AB7Z9'; $s =~ s/[A-Za-z]+\d(?!$)/$&:/gsi; print "s='$s'"

Prasad

Replies are listed 'Best First'.
Re^2: Best way to put : between fields in a string
by eyepopslikeamosquito (Archbishop) on Apr 21, 2005 at 11:14 UTC

    Minor correction:

    my $s = 'A3xyz45M98AB7Z9'; $s =~ s/([A-Za-z]+\d+)(?!$)/$1:/g; print "s='$s'\n"