I have price
variable and which can contain:
USD12.34
USD12,34
12,34
23.34
Now the output should be -
USD12.34 - false
USD12,34 - false
12,34 - true
23.34 - true
Now, Using JavaScript I want to validate above data as integer which should accept dot
and comma
.
I got this code but no luck:
const test = /^\d*(,\d{3})*(\.,\d*)?$/.test( price );
console.log( ( test ) );