If you want to match for the character “B” anywhere in the string, the regular 
expression you need is “.*B.*” (without the quotes). If you want a 
case-insensitive match, use “.*[bB].*”.
Matthew

From: [email protected] 
[mailto:[email protected]] On Behalf Of LarsR
Sent: 13 August 2013 11:14
To: [email protected]
Subject: Re: Conditional buildstep plugin regex match not working as expected?

Thanks Richard,
I have tested B.* and it works but it seems to do so because B is the first 
character in "BCSMLX". If I try something like C.* it fails. I realize might 
have been unclear in my first message but I want to check if a specific 
character is present anywhere in the test string. (The string represents six 
different build steps that I want to be able to switch on or off just by 
removing the letter for the step.)

Lars

Den måndagen den 12:e augusti 2013 kl. 21:08:03 UTC+2 skrev Richard Bywater:
Right off the top of my head, so likely wrong, how about B.*

I find if you don't use regexes everyday then its always hard picking them up 
again! :)

Richard

On Tuesday, August 13, 2013, LarsR wrote:
Hi,
I'm setting up Jenkins on Windows and plan to use some conditional build steps 
in my scripts, so I installed the conditional buildstep plugin together with 
the run-condition & token macros plugins.

I'm trying to use the regular expression match for the condition but cannot get 
a simple substring match to work. The test setting in the script defintion is 
as follows:

Expression: B
Label: BCSMLX

And the output when run is:

:
Regular expression run condition: Expression=[B], Label=[BCSMLX]
Run condition [Regular expression match] preventing perform for step 
[BuilderChain]
:

The only expression I manage to get to work is the one following the example 
doc for the plugin:

Expression: ^BCSMLX$
Label: BCSMLX

But for that I could as well use string compare.

Now I am no expert in regular expressions but all I find on the web indicates 
that expression "B" should result in a match if B is found anywhere in the 
string. I have also tried ^B and B{1} but none of these work either.

But I'm probably doing something stupid... can somebody please help me out?

My setup:

Jenkins 1.526
conditional buildstep 1.3
run-condition 0.10
token macro 1.8.1

Cheers,
Lars




-- 

This e-mail and any attachments may contain confidential, copyright and or 
privileged material, and are for the use of the intended addressee only. If you 
are not the intended addressee or an authorised recipient of the addressee 
please notify us of receipt by returning the e-mail and do not use, copy, 
retain, distribute or disclose the information in or attached to the e-mail.

Any opinions expressed within this e-mail are those of the individual and not 
necessarily of Diamond Light Source Ltd. 

Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments 
are free from viruses and we cannot accept liability for any damage which you 
may sustain as a result of software viruses which may be transmitted in or with 
the message.

Diamond Light Source Limited (company no. 4375679). Registered in England and 
Wales with its registered office at Diamond House, Harwell Science and 
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

 







-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to