How to make that regular expression for something like "1,3,5,2"? <p>I'm trying to make a regex for this:</p> <pre><code>1 1,1 1,1,1 1,1,1,1 </code></pre> <p>the 1's could be any digit (0 to 9)</p> <p>I guess it would be something like that:</p> <pre><code>/^\d{1}+(,+\d{1})?+(,+\d{1})$/ </code></pre> <p>But I don't know how to put that comma in the expression and to make sure there could be a maximum of 4 digits, separated by 3 commas. </p>