I need Regexone that only allows integers (positive and negative) separated by a comma 2,-3,4, but the comma should only be in the middle of two integers, not at the beginning or end or two consecutive commas such as 23,34,,4.
I currently have this:
Regex regex = new Regex(@"^\d{1,10}([,]\d{10})*$");
if (!regex.IsMatch("123,34,2,34,234"))
But it does not seem to match a single thing that even rejects valid inputs, such as 123,34,2,34,234
Could you please indicate what is wrong with my previous regular expression.
Maven source
share