I want to check if my string is numbers or numbers and comma, no other character is allowed.
That's my try:
if(myStr.match(/\d+(,\d+)*/g)) {
console.log("valid");
} else {
console.log("not valid");
}
It doesn't work as I wants, for example:
myStr = "12,15,as";
is "valid", but it shouldnt.
How can I fix it?