Regular expression validators

Vineela Durbha November 12, 2018

I am using Regular expression validator  during the create transition.

REvalidator.PNG

I am using [a-zA-Z0-9_=+-] because I need to allow special charterers (_,+,-,=, ).

Am I doing something wrong because this is not working and throwing error whenever i place '_' symbol.

 

2 answers

0 votes
Kalyan Chakravarthy September 2, 2022

While using regular expression to validate input data from user. 

So, what ever you wrote a regular expression in attributes should enclosed by parenthesis. 

For example:

([A-Za-z0-9+_= -]*) 

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2018

Sometimes you need to escape certain characters in order to have regex search for them. Since the syntax can be a little different depending on the interpreter.  Instead of using your string of

[a-zA-Z0-9_=+-]

try this one

[a-zA-Z0-9\_\=\+\-]

The character of '\' can be used to tell a regex to search specifically for the next character and not use that character's special regex function.   I don't know of any special function for the _ character in regex, but I think you can still try to escape it incase it is causing this to fail to match a character set you are looking for.

Vineela Durbha November 13, 2018

No it was not working.

I tried to do as below and it is working

[A-Za-z0-9+_= -]*

Suggest an answer

Log in or Sign up to answer