Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using RegEx to copy data from an Email Request and copying data into a custom field

Project - Reference Number: XX1-0111-AAProject - Version:

Trying to get the underlined number copied into a custom field:

RegEx: {{issue.description.match("(?<=Reference\sNumber:\s).*?(?=Project)")}}

Screen Shot 2021-04-06 at 12.57.15 PM.pngScreen Shot 2021-04-06 at 12.57.47 PM.png

1 answer

Hi @Tyler_Stephens_Arthrex_com  -- Welcome to the Atlassian Community!

What is happening when you run your rule?  And, what are you seeing in the audit log?

Best regards,

Bill

Hey @Bill Sheboy

Thank you! 

When I run the rule, the audit log shows it being successful and the field being successfully modified. However, the field is still left blank. 

Thanks,

Tyler Stephens

 

Screen Shot 2021-04-07 at 3.06.27 PM.png

Thanks for that information.  Given no errors in the audit log, I wonder if either:

  • your RegEx is too complex for the rule engine parser to handle
  • your RegEx doesn't match anything, and so evaluates to EMPTY

Maybe try writing with the Log Action to the audit log, gradually building up your RegEx until it stops working.  For example, add log lines for:

  • {{issue.description}}
  • {{issue.description.match(".*(Reference Number.*Project).*")}}
  • etc.

Note that you may need to use a suffix replace() function at the end to remove extraneous text if you only want the reference number in the custom field.

What do you think?

One note: If you have typos in your RegEx which cannot be parsed, the publish function for rules can hang/time-out.  So consider incrementally making changes so you can always fallback to an earlier version if you need to exit the rule editor.

 

Hey Bill,

I took your advice of using 

  • {{issue.description.match(".*(Reference Number.*Project).*")}}

and I discovered that it is pulling the styling elements of the email, so this must be what is interfering with my RegEx. 

I need to figure out a way to remove the styling elements from an Email Request now...

Thanks for your help!

Tyler Stephens

Like Bill Sheboy likes this

You may want to check on Stack Overflow, as there are some examples and gotchas for removing styling elements with RegEx.  You could also get close with RegEx, and then use the automation rule text functions to remove/replace remaining elements.

Please post what you learn as others in the community will no doubt be interested.  Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you