I would like to have a regex which accepts numeric along with specific special characters (.-,). I just learned about basics of regex and I don't know how come my pattern doesn't work, really need advice.
My Pattern
^(([0-9]*)+[.,\-]{0,1})$
(.,-) can only be repeated once, that's {0,1}. Also first should be numeric and last would also be numeric. I really need a little push.
Expected output
122-555-1521 //true
155--122 //false
155,- //false
.-12 //false
123.123. //false
.12 //false
1.2,1-3 //true
^\d+(?:[.,-]\d+)*${0,1}is shorter, and more commonly, written?.)