由于软件要求去掉注释,写了两个个正则表达式

去掉/**/(eclipse)----------------/\*(.|[\r\n])*?\*/
去掉//(eclipse)------------------ //.*$
去掉import(eclipse)------------ import.*$

去掉空行(ue) ------%[ ^t]++^p

 

第一个正则表达式参考这个

http://ostermiller.org/findcomment.html

Finding Comments in Source Code Using Regular Expressions

相关文章: