Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

regex help

Oleksandr Tymofyeyev
Contributor
August 29, 2023

using {{issue. Description}} contains regex .*Effective date: ([0-9]{4})-([0-9]{2})-([0-9]{2}).*

I get "The following issues did not match the condition" while the description has

Type of change: Intern
Type of contract: Intern
Effective date: 2023-08-28

 

I can't grasp where the error is in the code

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2023

Hi @Oleksandr Tymofyeyev 

Two things could be happening...

  • In your description field, are those field labels in fact bolded?  If so, the markup needs to be accounted for in your regular expression, with escaping for the asterisk:
    • match(".*\*Effective date:\* ([0-9]{4})-([0-9]{2})-([0-9]{2}).*")
    • Please adjust accordingly if that space after the colon is within the bolded region.
  • Next, IMHO the automation engine implementation of match() does not work well with either line breaks or multiple matches on a line.  To account for that, split the text first before matching:
    • {{issue.description.split("\n").match(".*\*Effective date:\* ([0-9]{4})-([0-9]{2})-([0-9]{2}).*")}}

 

Kind regards,
Bill

Oleksandr Tymofyeyev
Contributor
September 4, 2023

Thanks. You were right. It was both: we have to account for bold text AND deal with line breaks.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events