It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

scriptrunners versionMatch functionality searches also for history entries?

Michael Aglas Mar 28, 2018

when I use scriptrunners extension for JQL queries in JIRA like:

fixVersion in versionMatch("V00.01*")

I will also get issue that have a fixVersion set to "V00.02.00" for example, if the fixVersion of that issue was set in the past to e.g. "V00.01.00", but was changed afterwards. Does this really make sense? I want to get issues with a particular Version, but I get additional issues that are no longer assigned to this version... so this means to me, I cannot use this feature, because it distorts the result I want to have.

So is this a bug or is it a feature? Is it may be solved with another plugin version?

We are currently using Scriptrunner 5.0.14

1 answer

1 accepted

0 votes
Answer accepted
Andrew Heinzer Atlassian Team Mar 30, 2018

Using the versionMatch JQL function from scriptrunner is actually expecting to use a regular expression in regards to how these are being matched.  Please see the documentation on this projectMatch / componentMatch / versionMatch.

In which case, the asterisk * is expected to match the previous identifier repeatedly.   The other thing to note is that the period . will match any character when used in regex.  You have to escape characters like that.  So if you only wanted to find issues with versions that start with "V00.01" then your regex would probably need to look something like this

fixVersion in versionMatch("V00\.01\..*")


Note the escaped \. to match the "." characters, and then the additional .* will match any characters that follow this.  If you're not familiar with using Regex, I recommend using this site,   It has been endlessly helpful to me in understanding how my regex is actually be evaluated.

Michael Aglas Apr 02, 2018

I get following error using your regex example:

Error in the JQL Query: '\.' is an illegal JQL escape sequence. The valid escape sequences are \', \", \t, \n, \r, \\, '\ ' and \uXXXX.

Andrew Heinzer Atlassian Team Apr 03, 2018

Ah, my apologies.   Try it without those \ characters, and see if the results are more in line with what you are expecting here, such as

fixVersion in versionMatch("V00.01.*")
Michael Aglas Apr 03, 2018 • edited

Wow, thanks for nothing. Now, I again stuck with my initial complain.

Andrew Heinzer Atlassian Team Apr 04, 2018 • edited

Ok, turns out you need to also escape the escaping character.  yay.

Please try this instead.  

fixVersion in versionMatch("V00\\.01\\.")

If this does not work the way you would expect, please let me know specifically what fix versions are returned.   I can't see how this could return an issue with a fixVersion value of V00.02 But I can see how your first query could have returned a value such as V00.012 since in regex the period will match any character unless you escape it.

Michael Aglas Apr 04, 2018

Ok, this seems to really do trick. Thank you.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

859 views 12 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you