Fadi
Fadi

Reputation: 1419

Jenkins view regular expression

I have jobs in Jenkins that are named in this manner:

Dev.paas.****.****
Qa.paas.****.****
Stg.paas.****.****
Dev.pui.****.****
.
.
.
etc.

I'm trying to create a view that only shows paas, I enabled regex and I put the following:

*.paas.*

But Jenkins didn't like that and gave me an error.

enter image description here

What is the right way to do this?

Upvotes: 7

Views: 43332

Answers (2)

Patty
Patty

Reputation: 531

Also I think this seems to be case-sensitive. So if the folder name is Paas or PAAS, then it may not come in the filtered list of .paas.

Upvotes: 1

collapsar
collapsar

Reputation: 17238

The asterisk * carries special semantics in regular expressions ( namely 'any number of repetitions, including no occurrence at all' ).

Basic regular expressions match at any position in the test string. Therefore you do not need to describe the complete target string(s) in the regular expression., though it is good practice to do so in order to avoid false positives and to potentially speed up execution.

In short:

  • Just drop the leading *, or
  • precede the leading * with a . (matches any character except newline/line feed), or
  • (recommended) make sure that paas is only matched between two full stop characters: \.paas\. ( since . has a special meaning in regular expressions, , you have to escape it ).

Upvotes: 14

Related Questions