1

I'm trying to run a Jenkins build step based on a conditional regular expression match and I can't figure out why it doesn't match.

Here's how it looks in Jenkins: enter image description here

I'm using this regular expression: .*iOS. against a build parameter, pmt_content.

Here's the pmt_content value:

<body><pre>^1234567890^abc123def132afd1213afas^iOS^Test User^test@abc.com^iPad 3^</pre><img src='https://cirrus.app47.com/notifications/5626a0bc9ac25b6ea7003f2f/img' alt=''/></body>

Here's the console log telling me it did not match.

[PollMailboxTrigger] An email matching the filter criteria was found. (log)
Building in workspace /Users/jenkins/.jenkins/jobs/New Device Listener/workspace
Run condition [Regular expression match] enabling prebuild for step [Execute shell]
Regular expression run condition: Expression=[.*iOS.*], Label=[
<body><pre>^1234567890^abc123def132afd1213afas^iOS^Test User^test@abc.com^iPad 3^</pre><img src='https://cirrus.app47.com/notifications/5626a0bc9ac25b6ea7003f2f/img' alt=''/></body>]
Run condition [Regular expression match] preventing perform for step [Execute shell]
Finished: SUCCESS

Clearly pmt_content contains "iOS".

I tested the same values at www.regexplanet.com.

What am I doing wrong?

kraftydevil
  • 5,144
  • 6
  • 43
  • 65

1 Answers1

3

I experienced similar frustrations due to a newline character in my label data which prevented a match. Hard to tell from your dump if there might be a newline in there at the start. In any event you might try (?is).*iOS.*. Reference.

Community
  • 1
  • 1
gkmyers
  • 31
  • 3