matching multiple line string with perl regex and doing a replace

前端 未结 4 2057
孤城傲影
孤城傲影 2021-01-24 00:06

I have a source file where I use a macro to do logging. Typical logging lines look like:

STDOUT_LOG(logDEBUG4) << \"a single line log text\" << aVari         


        
4条回答
  •  囚心锁ツ
    2021-01-24 00:27

    You can use a regex like this with s (single line flag):

    \).*?<<(.*?);
    

    And the replacement string:

    , \1);
    

    Working demo

提交回复
热议问题