Replacing date in the summary field with a date from a date field using smart values and regex

Steve Rhodes
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 20, 2024

I have a use case where I want to replace the date in a summary with the date from a date field in the same issue. I have a not-quite-working automation, with help from @Bill Sheboy  here: https://community.atlassian.com/t5/Jira-questions/Update-summary-with-updated-due-date/qaq-p/2329197

But, the regex of (in the example linked post)

{{issue.summary.replaceAll("(\(.*\))",issue.duedate.format("(MM/dd/yyyy)"))}}

doesn't quite work and my date format is yyyy-MM-dd and despite changing the regex in the replaceAll to

{{issue.summary.replaceAll("(-(.*-))",issue.customfield_15528.format("yyyy-MM-dd"))}}

the summary of "2024-11-20 Summary text" here gets replaced with "20242024-11-21y text" with the new date being 4 characters out of place to the right and overwriting half of the date and some of the summary text.

I cannot seem to get the regex in the replaceAll working properly.

1 answer

0 votes
Marc - Devoteam
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.
November 20, 2024

Hi @Steve Rhodes 

I think you might miss a ( in the smart value clause, in front of yyyy.

I see 4 ( opens and 5 ) closers in your value.

{{issue.summary.replaceAll("(-(.*-))",issue.customfield_15528.format("(yyyy-MM-dd"))}}

Could it be the missing (?

Suggest an answer

Log in or Sign up to answer