I have an automation rule that creates a smart value variable "EmailReporter" using the following smart value
{{issue.description.match((?<=User\: )(.*))}}
And the issue description contains the line
"User: first.last@domain.com"
I've used a regex validation tool (regex101.com) to validate the regex (?<=User\: )(.*) which locates the email address, but I can't this to work in the automation rule. I need the email address to be able to update the 'reporter' field.
Can anyone see what I'm doing wrong?
{{issue.description.match("([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vikrant Yadav thanks for posting this. I just tried it and it appears to return the email value twice. Any thoughts on why that's happening?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @gjuffer Are you trying to insert email in ddscription field or in reporter ?
Above is for reporter field.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vikrant Yadav I've tried to insert as reporter and it kicked an error, so I tried to insert it as a comment and it returned "email@abc.com, email@abc.com".
When I enter the expression in a regex tester, it works fine. I don't know much about regex (which is why I'm googling stuff) but it seems like maybe it has something to do with grouping? Like maybe it's returning the original match and the group match? Maybe I need to go back to school for a computer science degree.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @gjuffer Reporter of an issue you can only set, if user account is created in JIRA. If user is not created then JIRA can't set email address as reporter. Do reporter have jira account ?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vikrant Yadav we have another automation that creates a new account from an email, that part is not a problem. The problem is getting only one email out of the description text, not the same email twice, separated by a comma. It must be something about how regex and JavaScript are interacting within the automation. I should probably just start a separate ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @gjuffer it seems that Description field is having email address mutiple times.
Check following link to capture correct email address from description, hope it works for you :-
Thanks
V.Y
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Positive look behind (?<=User\: ) might not be supported.
If you can use capturing groups, something similar to this might give you solution.
The mail address will be in group 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.