I am trying to build a regex that will match the following comma separated value:
Pattern: A,A,A
Where A contains only digits or digits separated by "|"
e.g. A = 111 or A = 111|222
The valid string could be
111,222|333,444
or
111|222,333,444
And the regex I have
^[[,]?[[\d]*|[\d]*\|[\d]*]]*$
However, when I test it, it returned true for the following patterns
111,222|333,
111,222,333|
,111,222,333|444
|111,222|333,444
How could I modify my regex to return false for those strings starting with "|" or "," and ended with "|" or ","