You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I need to perform a case insensitive exact search using issueFieldMatch() method.
To make special characters also readable in the search, I used the following code:
def count = 0 for (def i = 0; i < summary.length(); i++) { if (summary.charAt(i).toString().matches("[^a-z A-Z0-9]")) { // Check if there is a single special character found count++ } } if (count > 0) { //Special character was present in the string for (def j = 0; j < summary.length();) { if (summary.charAt(j).toString().matches("[^a-z A-Z0-9]")) { // To find whether current character is a special character or not //summary = summary.substring(0, j) + "\\\\" + summary.substring(j) //Inserting double backslash to make special characters readable in Regex j = j + 3 } else //If there was a character which was not a special character j++ } }
And, I used the variable in the below query:
def jqlSearch = "issueFunction in issueFieldMatch(\"project='Capacity Forecast' and issuetype ='Cluster Forecast' and 'Forecast' =" + previousForecastVal + "\", 'Summary', '^(?i)${summary}\$') ORDER BY issuekey DESC"
and in the below variable:
def sourcingSummary = "Sourcing: " + forecastIssue.summary + " - " + summarynewsubtask.summary = sourcingSummary
It worked fine for a long time, but now it is giving faulty results. It is returning value of variable "newsubtask.summary" with double backslash included in the string. Seems like we dont need double backslash to escape special characters anymore. Is it so? Has there been any change in the usage of "issueFieldMatch" ?
Current Script Runner version: 6.5.0
Current JIRA version: 7.13.5
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events