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

JIRA Smart Values replaceAll question about regex Edited

Hi there, I've been trying to get our email template (leveraging JIRA SD's new Project Automation features) to pick up images and (eventually) other unparsed content as well.

 

Here are some of the variations of the regex I have tried:

.replaceAll("!(.+?\.\w{3,4})\|width=(\d+),height=(\d+)!/gi", "<img src='$1' width='$2',height='$3'")

.replaceAll("/!(.+?\.\w{3,4})\|width=(\d+),height=(\d+)!/gi", "<img src='$1' width='$2',height='$3'")

.replaceAll("!(.+?\.\w{3,4})\|width=(\d+),height=(\d+)!/gi", "<img src='\1' width='\2',height='\3'")

and several other forms of it.

When I plug in the values on regex101.com, it finds the match no problem.

https://regex101.com/r/LNcuqg/1

_AcbHpawRi6hOrxiScUfuQ

 

 

Can anyone see what i'm doing wrong? I would love to be able to parse the images and translate them into html using regex so we can have inline images for our ticket reply emails! Happy to provide any additional info needed.

I feel like this would probably help others too. I can't find anything online that is JIRA Service Desk specific. (Yes, I've read the documentation)

https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/#Smartvalues-textfields-replaceAll(Stringregex,Stringreplacement)

https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll%28java.lang.String,%20java.lang.String%29

 

2 answers

0 votes
wwalser Atlassian Team Oct 11, 2020

Please attach an image of your automation configuration. I'd like to take a look at that in order to replicate on my own system.

I am also experimenting with this. I was not able to use $2 at all, only $1 appears to be working. Thus I struggled to obtain what I want inside $1, when not possible I continued the text processing with another replace() to remove leading and trailing characters

Also checking matches only does not help, you need to make sure $1 is what you want in your testing tool.

Finally, I got some results but then while $1 value looks OK in the testing tool in Jira automation I am always missing the last character for some reason... Still debugging

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

133 views 0 4
Read article

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