Front page | perl.fwp |
Postings from March 2002
Re: TPR1 post-mortem
Thread Previous
|
Thread Next
From:
Adam Spiers
Date:
March 8, 2002 08:27
Subject:
Re: TPR1 post-mortem
Message ID:
20020308162753.A16670@corelli.new.ox.ac.uk
Philippe 'BooK' Bruhat (philippe.bruhat@free.fr) wrote:
> What you want is:
>
> s/(?!^).(?!$)/$&$&/g
>
> Now, can we shorten it?
>
> s/\B.(?=\B)/$&$&/g
Except that that tickles the bug discussed elsewhere in this thread,
and is hence no use.
$ echo 1234 | perl5.6.1 -lpe 's/\B.(?=\B)/$&$&/g'
12234
> Anything better?
Yep :-)
s/(?=.(.).)/$+/g
Produces all but the penultimate pair in reverse order, which is of
course OK, because the function is symmetrical. I didn't end up using
it though, and noone else did either, it seems.
Thread Previous
|
Thread Next