Difficulty with Regular Expression Check validator

john_monteith
Contributor
February 18, 2025

I'm trying to create a "Regular Expression Check" validator and the field I'm checking is "Safety Impact" and it is a single choice drop-down with 3 choices (Yes, No, TBD). I used the following regex: ^(Yes|No)$ but it does not work. No matter what value is selected Jira will not allow the transition. It is the only validator on the transition.
I even double checked myself with a regex tester. Is there something I'm missing with how Jira handles this. Below is how the validator is listed in Jira:


 

The field Safety Impact content must match against the regular expression ^(Yes | No )$


Here is screenshot of error occurring showing that the value in the Safety Impact field is set to No

Screenshot (632).png

2 answers

1 accepted

4 votes
Answer accepted
Harrison Ponce
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.
February 18, 2025

Hi @john_monteith ,

I tested this and recreated a custom field single-select drop-down with values: "Yes" "No" "TBD" - Then, I used the following RegEx for the workflow field validator ^(Yes|No)$

This worked for me successfully, as intended.

I noticed your RegEx in bold has spaces between the other RegEx characters. That would surely give an error, if the actual value does not have spaces.

Might that be affecting the outcome here? Also want to confirm that your drop-down values in the custom field don't unintentionally have spaces after them?

john_monteith
Contributor
February 18, 2025

Thanks, I didn't pick up on the spaces, I know that they are "characters" in a string but just missed that. Eliminating the spaces did the trick. So embarrassing :)

 

Like Harrison Ponce likes this
Harrison Ponce
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.
February 18, 2025

No worries at all! It happens to the best of us. The number of times I've done something like this is more than I care to admit lol

Keep rocking your validators!!

2 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2025

Hi John,

I have not tried to put multiple options in the Regular Expression Check for two values but maybe try:

Option [Yes,No]

john_monteith
Contributor
February 18, 2025

Perhaps I should have included that in my post. Based on what was listed in the information field for this validator

  • Option [A,B] would allow a selection of options: Option A, Option B or both.


I also tried:

Option [Yes, No]
[Yes, No]

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2025

Maybe try with no spaces

Like Harrison Ponce likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2025

@john_monteith  - did you try this for future reference?

Suggest an answer

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

Atlassian Community Events