Forums

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

What is the regex used for the validation of custom field URL? Give the examples on the same

jahnavi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 15, 2019

What is the regex used for the validation of custom field URL in JIRA.

I need to know the valid pattrens on the same.

2 answers

0 votes
Roger Godfrey September 5, 2019

If you are needing a Regex to validate a url against that works like Jira validation, before pushing an issue through the API then try this:

^([a-zA-Z]+:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:)?([0-9]{1,5})?(\/.*)?$

This seems to behave like JIRA does.

You might need to massage the string to deal with the slashes in whatever language you are using.

I am not great at Regex, so if anyone wants to optimise or improve this, please have at it. :)

0 votes
Nic Brough -Adaptavist-
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.
April 18, 2019

It's not a regular expression, it's a bit of code that uses java.net.url

The "valid patterns" it checks for are simply "any valid url, as defined by the standards"

Suggest an answer

Log in or Sign up to answer