Forums

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

JMWE Validator to check specific words in description field .

Narendra Kumar
Contributor
May 11, 2020

Hi,

I have a list contains some words. I want to add JMWE validator on "Description" field(multi-line text field) to check that description contains all or some of these words.

Suppose my list has words as - ABC, DEF, GHI, JKL, MNO, PQR, STU, VWX, YZ.

How can I set validator to make mandatory description field for these words ?

 

Thanks!

1 answer

0 votes
David Fischer
Community Champion
May 12, 2020

You can create a "Build-your-own" Validator, with a Jira expression like:

!!issue.description && issue.description.plainText.match("(?i)\bABC\b") != null && issue.description.plainText.match("(?i)\bDEF\b") != null

to test whether the description contains the ABC and the DEF words in a case-insensitive manner. That is:

  • "one ABC two DEF three" will match
  • "one ABCd two DEF three" will not match because of the "d" after "ABC"
  • "one aBc two DEF three" will match ("aBc" matches with "ABC")

Note that the \b before and after the word are there to indicate "word boundaries" (the beginning and the end of a word) so that "ABCD" doesn't match with "ABC".

If you want to test whether the description contains the ABC or the DEF words in a case-insensitive manner:

!!issue.description && (issue.description.plainText.match("(?i)\bABC\b") != null || issue.description.plainText.match("(?i)\bDEF\b") != null)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events