Search for start of string

Jesper Thusgaard August 23, 2018

Hi 

I want to make a filter that shows me all "Product Name" that starts with a specific word (lets say microsoft) 

The filter should show me this case:

Microsoft Word

But not this case: 

Word Microsoft

Is this possible?  

4 answers

1 accepted

1 vote
Answer accepted
Jesper Thusgaard August 23, 2018

I already use ~ it gives me both all instances of the word im searching for. I ønly want the ones where the search word is the first in that field.

nija_kanthan August 23, 2018

You can filter with Regular Expressions.

Try the issueFieldMatch function from the Script Runner plugin. It offers the regex support that you seek.

Regex - /^Microsoft/
Like Marshall Zheng likes this
Jesper Thusgaard August 23, 2018

That is quite an expencive plugin just to do this one search.

Like # people like this
nija_kanthan August 23, 2018

Without Regular Expressions you cannot achieve start of string search.

  1. Regular expressions are not supported by JQL - (JQL Documentation)
  2. First character cannot be wildcard ( '*', '?' )

Screen Shot 2018-08-23 at 5.38.51 PM.png

Jesper Thusgaard August 23, 2018

OK, that is kind of sad. Seams to be a good thing to be able to do.

Like # people like this
Honza Stekl
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2024

I would even say very sad...

 

2 votes
Nathan Thornton July 17, 2023

This is old but I came across it when looking for the answer, the best way to do this (in 2023) is to use the contains character ~ with the * wildcard character like below:

summary ~ "Microsoft*"
Johan Fredrik Varen September 22, 2023

This worked wonders for me. I've tagged all tasks with a Version field on the form 1.2.3 (SemVer), and wanted a way to show e.g. all 1.2 tasks. Easy as

fixVersion ~ "1.2.*"

I tried without the asterisk, just the trailing period character, but that didn't work.

Johannes Weil October 30, 2023

@Nathan Thornton Thanks for the tipp.

I wanted to exclude all that start with "TEMPLATE: ".

summary !~ "TEMPLATE: " // did not work (as expected) :-|
summary !~ "TEMPLATE: *" // did not work :-(
summary !~ "TEMPLATE:*" // did work \o/

I cannot tell how much I love Jira!

0 votes
Piotr Bojko
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2018

Smart QL https://marketplace.atlassian.com/apps/1218767/smart-ql?hosting=server&tab=overview can do this:

 

Example (assuming Product Name is a custom field):

SELECT *
FROM TABLE(AUX.JQL('Key, `Product Name` AS `Product`','project = robustus'))
WHERE Product LIKE 'Microsoft%'

0 votes
nija_kanthan August 23, 2018

Try to use CONTAINS ( ~ ) Operator

summary ~ "Registration"

Suggest an answer

Log in or Sign up to answer