Forums

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

Validator

Jamil Rahimov
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.
November 30, 2020

Let suppose we have one text custom field and this customfield should be in this format:
1111 **** **** 1111 - in such format, only first 4 digits and 4 last digits must be entered

How can I do this using validator?

3 answers

1 accepted

1 vote
Answer accepted
Thorsten Letschert _Decadis AG_
Atlassian Partner
November 30, 2020

Hi @Jamil Rahimov ,

I'm probably still struggling with the understanding of your use case, so could you please provide a couple of examples for valid inputs?

Assuming the requirement is

  • start with four numbers
  • a whitespace
  • four alphanumeric values (letters or numbers)
  • another whitespace
  • another four alphanumeric values (letters or numbers)
  • another whitespace
  • end with four numbers

an expression matching this would be 

 ^\d{4}\s\w{4}\s\w{4}\s\d{4}$

Cheers
Thorsten

Jamil Rahimov
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.
December 2, 2020

@Thorsten Letschert _Decadis AG_ 
Examples:
4942 **** **** 7452
2514 **** **** 5893

Thorsten Letschert _Decadis AG_
Atlassian Partner
December 2, 2020

Hey @Jamil Rahimov ,

if you're after the '*' symbols, please use

^\d{4}\s\*{4}\s\*{4}\s\d{4}$

Cheers
Thorsten 

Like # people like this
Jamil Rahimov
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.
December 2, 2020
1 vote
Peter Preston
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.
November 30, 2020

Hi @Jamil Rahimov

@Thorsten Letschert _Decadis AG_ has the right expression from what I can see.

You could try this with ProForma Lite (free) by requiring users to match a regex pattern.

Here's what that looks like in the form builder:

Screen Recording 2020-12-01 at 14.13.55.gif

I am on the ProForma team, but thought I'd share this in case it helps get you what you need.

Jamil Rahimov
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.
December 2, 2020

@Peter Preston 
These are examples which this expression should check:

Examples:
4942 **** **** 7452
2514 **** **** 5893


Like Peter Preston likes this
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.
November 30, 2020

You'll need a scripting app, or something that provides clever validators to do this.

There are several apps that provide regular expression validators, I'd reach for one of those first (unless you have a load of other needs that bigger apps like Scriptrunner or Powerscripts might help with as well as being able to provide such a validator)

Jamil Rahimov
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.
November 30, 2020

@Nic Brough -Adaptavist- 
I tried Validation based on regular expression of JWT plugin but it didn't work for me.
Maybe I wrote something wrong
1.PNG

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.
November 30, 2020

That app has worked for me in the past.  I'm not a regex expert, I'd have to guess that there is something wrong in that?

Suggest an answer

Log in or Sign up to answer