问题
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