I have been using this regex to find reference to other ticket in comments and make a related link:
[A-Z]+-\d+
it works, but it is too general and often causes errors for things that aren't really a ticket descriptor. I changed to this:
[A-Z]{2,8}\b-\d{3,6}\b
which is specific enough to catch things much more finitely.
However, when the automation runs the command to establish the link
{{comment.body.match("{{[A-Z]{2,8}\b-\d{3,6}\b}}")}}
it fails because it is seeing the commas in the regex as delimiters and generates this error:
{{comment.body.match("{{[A-Z]{2: Issue does not exist or you do not have permission to see it., 8}\b-\d{3: Issue does not exist or you do not have permission to see it., 6}\b}}")}}: Issue does not exist or you do not have permission to see it.
Any ideas on how to fix this?
Do you mean to match the literal {{ }} sequences in your input string? If so, you might need to escape them.
{{ comment.body.match("\\{\\{[A-Z]{2,8}\b-\d{3,6}\b\\}\\}") }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you post a screenshot of your automation rule here? I suspect you're trying to attach the link, and search the comments in the same step.
If that's the case, I may suggest creating a Variable a few steps ahead in the rule, and then referencing that variable (if it returns something) in the Link step instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
and here's the original that works (but is too general, but doesn't need comma's)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the variable option and it seemed promising as it didn't cause a comma error, but it also doesn't seem to catch any return from the regex (even though the exact same regex is resolving as true in the IF comparison check. A log of the variable returns blank.
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.