Need help on a specific Regex <p>I want to validate an attribute of an xml file with an XSD file. This attribute must contain a list of comma-separated languages, like this :</p> <pre><code>&lt;Params languages="English,French,Spanish" /&gt; // OK &lt;Params languages="French,Spanish" /&gt; // OK &lt;Params languages="French" /&gt; // OK &lt;Params languages="English,French,Spanish,French" /&gt; // NOK (Two times French) &lt;Params languages="English,Spanish,French," /&gt; // NOK (Comma at the end) </code></pre> <p>So i try to write a regex pattern to validate this. Here are the constraints :</p> <ul> <li>I must have at least one language</li> <li>I cannot have a comma at the end of the string</li> <li>I one language can appear only one time in the string</li> <li><strong>EDIT : I have an important list of possible languages</strong></li> </ul> <p>The two last constraints are the problem, i don't know how to do it.</p> <p>Here is what i got now : </p> <pre><code>^[English,|French,|Spanish,...]+$ </code></pre> <p>But it's really poor. Thanks for your help.</p>