Hi,
I want to extract a serial number that is in a middle of some text in my issue.summary.
The format of my serial number is: "E-" followed by 7 numbers (i.e: E-1234567).
I have created a variable: {{issue.summary.match("E-\\d{7}")}} but it returns nothing.
I also tried: {{issue.summary.find("E-\\d{7}")}} but it returns nothing.
Any idea?
Thank you!
The solution you found will match to any characters, and not just digits. For example, E-abcdefg.
Please try this one to match only to the seven digits in the expression:
{{issue.summary.match("(E\-\d{7})")}}
Kind regards,
Bill
I've used Himanshi's solution {{issue.summary.match(".*(E-\\d{7}).*")}} and it matches only to the seven digits.
What do the \ mean?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That depends upon what follows the forward slash character...
According to the Atlassian documentation, the "underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches", with emphasis added by me.
Thus \d is a digit, 0-9, and the forward slash may indicate other expressions or escape the character that follows. For example, \- escapes the dash for use in the expression.
In my experience with Jira automation rules, one must experiment and fully test to know what does and does not work with their implementation of regular expressions. This will prevent surprises, such as the known racetrack error problems when using regular expressions with different rule features.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've solved my problem. I should have written:
{{issue.summary.match("(E\-.{7})")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Priscille,
Welcome to the community! Thank you for sharing the use case with an example and attempted smart values. It was helpful for me to understand what di'nt work for you.
You can try {{issue.summary.match(".*(E-\\d{7}).*")}} to fetch the Serial number.
I added ".*" before and after the regex to indicate that the summary could start and end with any character.
Please try this smart value and consider to mark this answer if it works for you.
Have a lovely day ahead!
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.
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.