条件正则表达式排除某些目录 [英] Conditional Regular Expression to exclude certain directories

查看:832
本文介绍了条件正则表达式排除某些目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从分析代码覆盖率中排除某些代码目录.我正在使用具有--exclude参数的LCOV工具,可以包含一个正则表达式来排除文件,包等...

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...

排除Src/High/SS/FormCalc之外的所有方向的正则表达式是什么:

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是我要包括的唯一软件包.

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

正则表达式是什么?

推荐答案

排除您提供的除Src/High/SS/FormCalc之外的所有路径:

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

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

在此处查看演示: https://regex101.com/r/CYRDJp/1

这篇关于条件正则表达式排除某些目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆