in reply to Regex and \G

I would use:
s!^((?: {8})+)!"\t" x length ($1) / 8!e;

Abigail

Replies are listed 'Best First'.
Re: Re: Regex and \G
by Melly (Chaplain) on Oct 23, 2003 at 09:20 UTC

    Ah, but then I wouldn't know what I was doing... ;)

    Many thanks, though.

    Tom Melly, tom@tomandlu.co.uk
Re^2: Regex and \G (oops)
by tye (Sage) on Oct 23, 2003 at 14:38 UTC
    s!^((?: {8})+)!"\t" x length ($1) / 8!e;

    Why would you want to replace leading chunks of spaces with "0" while generating a warning?

    Yet another example of why we should have a few more levels in the Perl precedence table.

                    - tye
      Why would you want to replace leading chunks of spaces with "0" while generating a warning?
      Because tabs are evil, and it's good that when there's an attempt to summon evil, warnings are generated, and harmless beings (the 0's) are send instead.

      Abigail