Hi,
I am trying to add a regular expression in the scripted validator in Jira Cloud for the text field with an email address.
I tried with
issue.customfield_10000 =~”^([])$”
But it is failing.
The error is:
Jira expression failed to parse: line 1, column 24: ., ?., [, ?.[, (, *, /, %, +, -, <, <=, >, >=, ==, !=, &&, ||, ??, ?, ; or EOF expected, = encountered.
I can use the native way but it doesn't allow me to add a custom error message.
I found the answer myself:
issue.customfield_10000.match('^([])$')!=null
This worked like a charm.
You can validate any regex against a custom field during a transition.
Hi @Anzar
Could you provide a little bit more information on what you want the Regex to do and where are you setting the regex to do?
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want the regex to validate if the email field has the correct value.
for example: ramkum@..
is an incorrect form of email.
ramkumar@gmail.com
is a valid email.
Regards,
Anzar Khan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Anzar
I can't tell if the regular expression is valid or not, but the error tells you that you should use "==" operator, not "=" since you compare two values.
Best regards,
Alisa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alisa,
I dont want to do an equal comparison, I want to compare a regular expression with a string.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.