I have a problem to convert input in HTML to specific criteria :
- Maximum 4 digit with dot (ex : 5.100)
- Only accept number
- Separate with dot if thousand
I am able to achieve the last two with this :
value.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ".");
How to add the first criteria ?
And seems like my regex is too long, a shorter one would be great.