Search code examples
regexgitlabcode-coveragegitlab-ci

Gitlab Test Coverage Parsing Branches only


I'm trying to implement a regex that will output the Code Coverage only for Branches after running the dotnet test command by using the Gitlab CI Test coverage parsing but I'm a little bit stuck.

Regex is kind of hard for me, and I don't understand why this command isn't working properly ^\s*(\d+(?:\.\d+)?%)\s*lines

Does anyone have any ideas? Thanks in advance!


Solution

  • The easiest way to debug is to use a service like https://regexr.com.

    I have put your regex in https://regexr.com/49pjk with an text input example, and you can see:

    • what is or is not matched by your regex
    • how your regex is structured

    With that, you should be able to debug it.