Is there a way to parse comment bodies when creating a action

I am creating a rule that will create a new story whenever an individual comments on any story with a comment that has a certain format. Is there a way, when executing the story action, to parse the comment body, maybe using regular expressions, so I can allow the user to enter multiple parts of the story(like for example, the summary and description) in the comment?

2 answers

Can you elaborate more on what do you mean by "executing story action"? 

If you just need to parse the comment section of a JIRA issue, what I can suggest to you is to create a JIRA IssueUpdateListener so that whenever an issue is updated with a comment, you get the value of that comment and parse it based on a syntax you pre-define (e.g. it should be in the format like [Summary: This is the Summary, Description: this is the description].

0 vote
Andreas Knecht Community Champion Apr 25, 2017

Hi Matt,

So you can use the 'Compare condition' to perform regular expression matches on comment body using this smart-value:

{{comment.body}}

We also include a number of string functions to do further matching (or to extract certain values from a string). See https://codebarrel.atlassian.net/wiki/display/AUTO4J/Working+with+Strings for more details.

So for example you could use a match like this:

{{issue.summary.match("_([^_]*)_")}}

If your comment body contains 'Hello _world_ today!' then this would simply render 'world'.

Cheers,

  Andreas

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

166 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you