Azure Pipelines Build Quality Checks Error: The expression is not a valid regular expression and will be ignored

Viewed 37

I'm trying to config a Build Quality Checks task to get errors like ones below using a regex expression.

ERROR: abc
ERROR: xyz

The regex expression that I used was the one below. The idea is to return the data as a named group 'message'

/ERROR: (?<message>.+)/ig

Azure keeps returning that the regex expression is invalid

##[warning]The expression '/^ERROR: (?<message>.+)/ig' is not a valid regular expression and will be ignored.

From my understanding this regex expression is correct according to https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/WarningsPolicy.md documentation.

If I check this regex expression in https://regex101.com/ it work fine. What am I doing wrong?

Thanks.

1 Answers

If you want to get all of the ERROR messages, the regex should be like this:

/ERROR: (.*)/ig

enter image description here

Is the above your requirement?

I can get nothing via your regex:

enter image description here

And if possible, please share your yml and clarify more clearly about your question(remove the in-private information.).

Related