Skip to main content

Hi i want regular expression for the format e.g. JXN-12345-1, JXN-12875-2, ALA-3165-0 etc the values changes every time 
I’m using regular expression that is 
But it gives me False result(it gives me result that is not in this format) Please someone guide me where is my issue, how to resolve that issue
 


 

 

From the examples you’ve mentioned (JXN-12345-1, JXN-12875-2, ALA-3165-0) the Regex you are using is ^sA-Za-z]{3}-\d+-\d$.

The format you want looks like : 3 alphabets - any number of digits - single digit. You can add {1} for the last digit. ^tA-Za-z]{3}-\d+-\d{1}$$

If it doesn’t resolve, please give an example of false result which you are getting and don’t want.


@Aima Arif 

Try using the following:

^^A-Z]{3}-\d{4,5}-\d{1}$

 

Regards


Reply