java替換注釋正則表達式


由於軟件要求去掉注釋,寫了兩個個正則表達式

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

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

 

第一個正則表達式參考這個

http://ostermiller.org/findcomment.html

Finding Comments in Source Code Using Regular Expressions


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM