regular expression for textbox length

2

How can I make a regular expression to validate that in the textbox enter a maximum of 19 digits and a minimum of 15?

What I have is this ER but I think it's wrong

var expreg = /^([0-9])*{0,25}$/;  
    
asked by Ivxn 05.07.2016 в 22:01
source

1 answer

5

Your Expression is wrong in * .

Then your expression should look like this:

var expreg = "^([0-9]){15,19}$";

What makes * take no value to infinity, so if you want a minimum and a maximum you specify it in {min,max}

I leave this regexpal website for validation of regular expressions and this another web of regex101 more complete than commented @DanielFaro.

    
answered by 05.07.2016 / 22:16
source