Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Table Transformer: How to do a global RegEx search via ->match() properly?

Stephan Bauer March 31, 2023

I am not sure if the 'g' flag is not working for RegEx searches via js in the Table Transformer plugin or if I simply do something wrong...

What I want to do now is find the latest sprint an issue was assigned to.

Fortunately we have a defined numbering scheme which is included in every sprint name of every team.

So my plan is to pull issues from JIRA, do a global regex on the content of the Sprint field, sort the result (which should be an array of Sprints according to our naming scheme) and pop the last item.

So, in theory, this should do it:

SELECT *,
    T1.'Sprint'.match("/[0-9][0-9].[1-5].([1-6]|IP)/g")->sort()->pop() As 'Latest Sprint',
FROM T1

Unfortunately it seems that using the "g" flag leads to an empty result.

Any ideas?

P.S.: The markup for an example table

||Key||Sprint||
|MC20-2943|MC20-23.2.1 (Feb 26) MC20-23.2.2 (Mar 12) MC20-23.2.3 (Mar 26) MC20-23.2.4 (Apr 09)|

1 answer

1 accepted

4 votes
Answer accepted
Katerina Rudkovskaya _Stiltsoft_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 31, 2023

Hi @Stephan Bauer,

Please modify your SQL query as following:


Fri 1-1.png

SELECT *,
MATCH_REGEXP(T1.'Sprint',"[0-9][0-9].[1-5].([1-6]|IP)", "g")->sort()->pop() As 'Latest Sprint'
FROM T1

Fri 1-2.png

This query should be working fine.
You may also read more about the MATCH_REGEXP function here (the second table, row #145).

Stephan Bauer April 3, 2023

Thanks, this works for me.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events