The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Stephan Bauer
Contributor
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
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
Contributor
April 3, 2023

Thanks, this works for me.

Like • # people like this
TAGS
AUG Leaders

Atlassian Community Events