java替换注释正则表达式

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

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

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

 

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

http://ostermiller.org/findcomment.html

Finding Comments in Source Code Using Regular Expressions

posted @ 2012-08-04 19:57  楚广明  阅读(3411)  评论(0编辑  收藏  举报