Re: a regex question ..



On Sat, 30 Apr 2005 20:10:59 +0200, Gunnar Hjalmarsson
<noreply@xxxxxxxxx> wrote:

>> Just keep in mind that this will change 'aaa11bbb12' to 'aaa0101bbb0102'
>> which is probably not what the OP wants.
>
>That's my interpretation as well. How about:
>
> (my $newname = $name) =~ s/(^|\D)(\d)(?=\D|$)/${1}0$2/g;
> rename $name, "new-$newname";

Gunnar,

Thanks - that was problem I was trying to sort ! Your code works fine.

Cheers all

Geoff
.



Relevant Pages

  • Re: N&H Rankings - Division I Men (12/12/05)
    ... By far the greatest ranking system... ... oh never mind. ... Prev by Date: ...
    (rec.sport.basketball.college)
  • Re: Redick on the Olympic team?
    ... > Early word on the homerkook boards is that Nelson will be okay. ... oh, never mind. ... Prev by Date: ...
    (rec.sport.basketball.college)
  • Re: a regex question ..
    ... >That's my interpretation as well. ... Gunnar, ... Geoff ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: Is State Vector Reduction a Process?
    ... >> I may have confused the official Copenhagen interpretation with ... >> what Bohr, Heisenberg, von Neumann and so on believed. ... >> pointed out in this thread, Heisenberg said "The discontinuous change ... >photographic plate or in the eye, not in the mind, and is simply ...
    (sci.physics.research)
  • Re: London blasts
    ... >>>I suggest that every interpretation is, ... and indeed I can't be expected to know in advance the mind of ... Anyone's expectations about this matter are irrelevant. ... > practice is better than having a small number of very long discussions ...
    (uk.religion.christian)