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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,642,293
Community Members
 
Community Events
196
Community Groups

Regular expressions (regex) for cloning part of description

Hi all

 

I'm trying to make a manual triggered automation, that when triggered evaluates the triggerissues description through a regular expression, and then copies it to a new issue(or a linked issue)

I'm however stuck at the regex part, and can't seem to make it work. I'm trying to log to audit log

The trigger issues description will always have a structure with a number of defined headlines eg. 

h2. Why - what is the potential business value hoped to achieve?
Lorem ipsum
h2. Assumptions / prerequisites
More lorem ipsum
h2. Breakdown
even more lorem ipsum
h2. Acceptance Criteria

# acceptance lorem ipsum 1
# acceptance lorem ipsum 2

So what I want is to get all sections headline and lorem ipsum text, except the breakdown section. And then add the rest of the sections to the linked issues description.

I've tried even very simple regex'es eg. just trying to find the "Why" in the first section and the rule succeeds but there's nothing in the log, so it's like I cant access the result/group and print/log it

This xyz: {{issue.description.match("Why").group(0).toString()}} :321 just succeeds and only logs xyz: :321

Any help or pointers would be greatly appreciated :)

Thanks

1 answer

0 votes
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.
Nov 11, 2020

Hi @Anders Baisgaard 

Your example with "Why" finds nothing matching exactly that: "Why".

Instead you need to match on any leading or trailing characters (from your example), such as the expression ".*Why.*"  Then use the split() function on the resulting group to get what you want to focus upon.  (Or skip the match and go right to using split...  :^)

Please considering reading some of the on-line tutorials on RegEx expressions, and then see if those help.  There are some linked to the help documentation for the match() function from Atlassian: https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/

Best regards,

Bill

Hi @Bill Sheboy 

I not only considered reading that, I actually read that documentation, but apparently didn't get it right :)
I'll give your suggestion a go and see if it solves my problem - thx

/Anders

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events