in reply to Re^2: Regex for replacing a character "not next to" another character (updated)
in thread Regex for replacing a character "not next to" another character

For a multi-line string, simply add \n to the negated character group:

s/(?<=[^"\n])\t(?!"|$)//gm

and of course a /m for the $

  • Comment on Re^3: Regex for replacing a character "not next to" another character (updated)
  • Download Code

Replies are listed 'Best First'.
Re^4: Regex for replacing a character "not next to" another character
by LanX (Saint) on Nov 04, 2016 at 11:36 UTC
    OK, but in this case, for the sake of readability and maintainability, better stick with one approach
    DB<105> p $str =~ s/ (?<=[^"\n]) \t (?=[^"\n]) /***/gxr start***middle1 "quote1***quote2" middle2***end start***middle1 "quote1***quote2" middle2***end

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!