Hi,
I'm trying to create a regular expression that I can use to remove email signatures from issues created from emails. I have something that works quite well in Notepad++ but it won't work in a replaceAll() function in a Jira automation over the description field.
One of the problems seems to be that replaceAll() (and also match()) doesn't seem to be able to match linebreaks.
In addition, I have not been able to successfully use '^' or '$' to match line beginnings or endings.
So, my questions are:
1. Can somebody give me working example of a replaceAll() statement that uses '^', '$' and especially '\n'?
2. Is it somehow possible to make the dot greedy so that it consumes newline characters?
Thanks in advance,
Alex
Hi Alex,
Developer from Atlassian here.
Currently the regex expressions in Automation are using Java pattern matching. So when trying out expressions is best to use one that you can select the Flavour of Java e.g. https://regex101.com/?flavor=java&flags=g. The reason ^ and $ aren't working is by default multiline is being turned off (you can simulate that in that regex link). So you need to use the manual way of turning it on which is putting (?m) at the start of the regex.
Similar with using dot matcher on new lines, you'll need to use specify (?s) to force the regex into that mode.
Example of using replaceAll to remove part of an email address from the issue description:
Hope that helps, you can also get in touch with support if you require further help with your rule.
Cheers.
Welcome to the community. Have you looked at this following page dealing with automation - text operation - https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Hope this helps.
Best, Joseph Chung Yin
Jira/JSM Functional Lead, Global Infrastructure Applications Team
Viasat Inc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.