How can I strip multiline C comments from a file using Perl?

前端 未结 6 1150
情话喂你
情话喂你 2020-12-03 04:02

Can anyone get me with the regular expression to strip multiline comments and single line comments in a file?

eg:

                  \" WHOLE         


        
6条回答
  •  [愿得一人]
    2020-12-03 04:53

    This is a FAQ:

    perldoc -q comment
    

    Found in perlfaq6:

    How do I use a regular expression to strip C style comments from a file?

    While this actually can be done, it's much harder than you'd think. For example, this one-liner ...

提交回复
热议问题