Regex to replaceAll in Jira global automation with $1

Blake Berk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 11, 2025

Similar to the regex response in: 

https://community.atlassian.com/forums/Jira-questions/How-can-I-replace-part-of-a-file-path-using-Jira-Automation/qaq-p/2876818

I am trying to send a file path through 'Send web request' in global automation. The file path looks like C:\Users\Company\Person\Documents\Folder\File\Base

When this is processed as {{issue.fields.customfield_10030}} I get an error for \\F as a bad json exit. I have tried to use {{issue.fields.customfield_10030.replaceAll("\\\\F","\\F"}} - which works, but is not robust. When I tried to be more intelligent using regex, I can't seem to get the $1 to work. 

{{issue.fields.summary.replaceAll("\\\\([A-Za-z])","\\$1")}} this just makes it a literal $1 and no backslash is processed either: C:$1sers$1ompany$1erson$1ocuments$1older$1ile$1ase.

Ultimately, the root issue is sending the raw \\\\ to json is causing issues. Solving that would be best, but a regex to replaceAll that works would be the next best thing.

1 answer

2 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.
March 11, 2025

Hi @Blake Berk -- Welcome to the Atlassian Community!

First thing, I would try using the JSON encoding text functions without replacing anything: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonEncode--

If that does not help, try using the replace() function with plain text rather than the replaceAll() function with regex.

 

And if that does not help, please post the following for context to help the community offer better suggestions:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule in a single image for continuity,
  • images of any relevant actions / conditions / branches, and
  • an image of the audit log details showing the rule execution.

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events