Regex in automation not working

Becky November 19, 2024

My group is using an issue collector.  When an issue is created via the collector, the following information is added to the Description field: 

Reporter: Person X's name
Email: Person X's email

Because that is not particularly helpful, we need the information following "Reporter: " (i.e., Person X's name) to be copied to a custom text field called "Submitted by". 

I created an automation using the guidance here and have a similar set of steps as in that example.  My regex for the THEN step, which completes the "Submitted by" field, says:

{{issue.description.match(".*Reporter: (\S+).*")}}

But that is not copying information over to the "Submitted by" field.  Unhelpfully, the audit log for the automation says it was successful and is showing no errors.

Any idea of what might be wrong?  I am new to regex but from what I can tell from online sources, the regex above is correct for my purpose. 

1 answer

1 accepted

0 votes
Answer accepted
Ramin Shanehsaz
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.
November 19, 2024

Hi,

I’m unable to open your link, but it’s possible that the regex isn’t matching due to the formatting of:

Reporter:

In Markup, this is formatted as:

*Reporter:*

You’ll need to adjust the regex accordingly, like this:

".*\*Reporter:\* (\S+).*"

(Be sure to pay attention to the space placement after the colon.)

The best approach is to change the description of an existing issue to "Text" format to check how it’s structured.

I hope this helps.

Best,
Ramin

 

 

Becky February 19, 2025

Thank you for the reply!  You were spot on.  The bold markup was the issue.  (The colon in "Reporter:" is not bolded by the issue collector, so I moved the ending markup you suggested back a bit so that the colon was not in bold.)  Final:

{{issue.description.match(".*Reporter\*: (\S+).*")}}

I apologize for asking when you have been kind to respond at all, but I now have a slightly different problem.  The above regex does move information from the Description field to the desired custom field but only the first part of someone's name.  

So this information in the description field:

Reporter: FirstName LastName

Is adding to the "Submitted by" custom field as just:

FirstName

Is there a way to make the regex capture the entirety of the name?

I unfortunately cannot change the Description field from markup to Text, as our project is used by multiple groups and for multiple purposes.  

p.s.  I also fixed the link in my original question/submission. 

Suggest an answer

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

Atlassian Community Events