Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 997
Fadi Avatar asked Nov 25 '15 17:11

Fadi


Video Answer


1 Answers

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 ).
like image 82
collapsar Avatar answered Sep 20 '22 22:09

collapsar