I have written a small regex for javascript. It should only accept numbers separated by commas.
Valid examples are:
1 single value allowed
1,278,3780,50
1,56,90, (trailing comma allowed)
Invalid examples are:
1,45 67
1, gj, + (any special character and characters)
The regex is: /^[\d|\,]+/g
However, it also accepts | (pipe character).
Like: 1|46|6778|567
What am I doing wrong? What did I miss? Please follow this link to my regex