Conditional Regular Expression to exclude certain directories

烈酒焚心 提交于 2019-12-24 08:35:01

问题


I'd like to exclude certain directories of code from getting analyzed for code coverage. I'm using the LCOV tool which has a --exclude parameter which I can include a regular expression to exclude files, packages, etc...

What would be the regular expression to exclude all directions except for Src/High/SS/FormCalc:

Src/High/SS/ATG_Help    
Src/High/SS/ConvCalc    
Src/High/SS/ConvX   
Src/High/SS/EFiling 
Src/High/SS/Edit    
Src/High/SS/FormCalc    
Src/High/SS/FormDisp    
Src/High/SS/Image   
Src/High/SS/Import  
Src/High/SS/Importables 
Src/High/SS/Intrview    
Src/High/SS/Intrview/Dialog 
Src/High/SS/Intrview/Dialog/Facades 
Src/High/SS/Intrview/Dialog/Facades/PrivateHeaders  
Src/High/SS/Intrview/Dialog/PrivateHeaders  
Src/High/SS/Misc

Src/High/SS/FormCalc is the only package I want to include.

What is the regex for this?


回答1:


Exclude all paths that you presented except Src/High/SS/FormCalc:

Src\/High\/SS\/(?!FormCalc).+

See demo here: https://regex101.com/r/CYRDJp/1



来源:https://stackoverflow.com/questions/39842139/conditional-regular-expression-to-exclude-certain-directories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!