I was trying to split a string that was | delimited. Turns out .split("|") broke it into a list of individual characters. Instead .split("\|") had the intended effect.
So | requires an escape character. What other characters require escaping? Add what you have found in the comments.
Hi @Fede B.
The parsing order can cause symptoms like that. One workaround is to use created variables. For example:
{{issue.description.replace(varSearchValue, varReplacementValue)}}
This also helps when using regular expressions, although there are extra steps to escape the characters.
Kind regards,
Bill
Hi, a bit late, but I'd like to add that I noticed that replace() works fine when searching for single { but returns error when searching for double {{
I bet it's because the double curly creates confusion with smart variables delimiters.
Escaping the double curly doesn't seem to resolve the error...
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aron Kuch
That is an interesting question, and I also find the escape-needing characters for rules (with and without the Atlassian implementation of regular expressions) are not documented...or at least not on the automation documentation pages :^)
I wrote a quick test rule, using most of the printable characters in a created variable to drive an advanced branch, using your split("|") technique, and then used each one to split the very same string without escaping. These are the ones which did not work at all (and so probably need to be escaped):
?
$
'
(
)
*
+
-
.
?
|
And these seem context-dependent for the string being split:
"
The remainder all seemed to work, but I would test further if I needed this for a production rule. If you try the same test, please post what you find. Thanks!
Kind regards,
Bill
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.