in reply to Re: Perl regex. Why does this happen?
in thread Perl regex. Why does this happen?

Based on the data you've provided, s[(\s{2})(?=\d)][2]g should do what you want.
Or (more simply, IMHO) use \h [horizontal whitespace] instead of \s

Replies are listed 'Best First'.
Re^3: Perl regex. Why does this happen?
by AnomalousMonk (Archbishop) on Jun 07, 2016 at 04:02 UTC

    \h added with Perl version 5.10.


    Give a man a fish:  <%-{-{-{-<

      If you want to be backward compatible, you can substitute [^\S\n] for \h.

      - tye