更新时间:2023-01-14 14:21:33
我会这样做,
perl -0777pe 's/\/\*(?:(?!\*\/).)*\*\/\n?//sg' file
示例:
$ cat fi /* comments comments comments comments */ bar $ perl -0777pe 's/\/\*(?:(?!\*\/).)*\*\/\n?//sg' fi bar
删除多行C样式/ *注释* /使用Perl regex
使用RegEx在C ++中删除多行注释