Philippe 'BooK' Bruhat ([EMAIL PROTECTED]) 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.

Reply via email to