Regex validation for emails won't work when email is turned into a link?

Apk Zity
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!
February 19, 2024

Have a rule on Jira for when {{issue.description}} does not match regular expression and the regex expression to validate email is [\w\d\\:\.]+test\.com. When the issue is created, the email turns into <a href=emailto:> which makes it a link apkzity. When it is a link it does not trigger the automation, however when I tried the same regex with the linked email in several regex validators it works fine. Unsure if it's something with Jira at the time of creating issues that breaks this trigger?

Tried multiple regex validation which worked fine, just doesn't work in Jira itself. Works if it's normal text, but not when text is turned into link. Tried issue.descriptionhtmlencode.

2 answers

1 accepted

1 vote
Answer accepted
Hariharan Iyer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2024

Hi @Apk Zity ,

 

You can try something like this to extract the email

{{issue.description.substringAfter("mailto:").substringBefore("]")}}

Hope that helps!

0 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.
February 19, 2024

Hi @Apk Zity -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

The Atlassian documentation for the match() function's usage of regular expressions states (with my emphasis added):

The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches.

But it does not state explicitly what is (and is not) actually supported.  https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

There are many community posts indicating differences from both the Java spec and, as you describe, with other regular expression parsers.  With no specific guidance from the Atlassian team on the supported regular expression syntax, my recommendations are:

  • try the simplest possible expression that will work (with no edge case handling), and incrementally improve it as you test your rule
  • ensure you use a group in the match, noting only the first group will be returned by the match function
  • the parser cannot handle multiple lines / whitespace well, and so consider first splitting on spaces or new lines before the match, using the split() function

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer