in reply to Re: replace fist and last occurrences of N
in thread replace fist and last occurrences of N

This replaces the first and last n in each n run with ^ (rather than quoting the n run). It also "quotes" all n runs, not just the first and last as required by the OP.


Perl is environmentally friendly - it saves trees
  • Comment on Re^2: replace fist and last occurrences of N

Replies are listed 'Best First'.
Re^3: replace fist and last occurrences of N
by jethro (Monsignor) on Jul 13, 2008 at 01:16 UTC
    Read again. The OP wanted a replacement and not a quote.

    I made sure now by making a diff between the output of my program and what he gave as wanted. Absolutely identical.

      I apologise. You are quite right. My first read through the OP's node left me with the impression that his problem was a whole lot more interesting than it is! I thought he was wanting to quote the first and last run only, leaving all other n/N runs unaltered.


      Perl is environmentally friendly - it saves trees
        I agree, that is more interesting. So at least you had more fun writing your solution than I had ;-)