I have been struggling to find a regular expression that will work in the "Test coverage parsing" input on the "CI/CD Pipelines" page. It doesn't help that the examples show inconsistent examples, i.e. some escape parenthesis and other don't, same with percent symbols, some capture the explicit result in $1
, etc. Anyway, here is my text - whats the regex?
CI Badge:
![coverage](https://gitlab.com/mycompany/master/badges/master/coverage.svg?job=coverage)
Output text:
Unit test coverage:
10.01% blocks
10.01% lines
Tried so far: (added the slashes simply to represent the space at front or regex)
/ \(\d+\.\d+\%\) blocks/
/ (\d+\.\d+\%) blocks/
/ (\d+\.\d+%) blocks/
/ (\d+\.\d+)% blocks/
The issue was that the coverage URL query "?job=coverage" was incorrect. As for the regex, I used:
\W(\d+(?:\.\d+)%)\sblocks