Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a regex that will work for all your cases:</p> <pre><code>([a-z]+([,-][a-z]+)*|\*)(:([a-z]+)([,-][a-z]+)*|\*)* </code></pre> <p>Here is a detailed analysis:</p> <p>One of the basic structures used to build complicated regular expressions like this is actually pretty simple, and has the form <em><code>text</code></em><code>(</code><em><code>separator text</code></em><code>)*</code>. A regex of that form will match:</p> <ul> <li>one <em>text</em></li> <li>one <em>text</em>, a <em>separator</em>, and another <em>text</em></li> <li>one <em>text</em>, a <em>separator</em>, another <em>text</em>, another <em>separator</em>, and yet another <em>text</em></li> <li>or more, just add another <em>separator</em> and a <em>text</em> to the end.</li> </ul> <p>So here is a breakdown of the code:</p> <ul> <li><code>[a-z]+([,-][a-z]+)*</code> is an instance of the pattern I discussed above: the <em>text</em> here is <code>[a-z]+</code>, and the <em>separator</em> is <code>[,-]</code>.</li> <li><code>([a-z]+([,-][a-z]+)*|\*)</code> allows an asterisk to be matched instead.</li> <li><code>([a-z]+([,-][a-z]+)*|\*)(:([a-z]+([,-][a-z]+)*|\*))*</code> is another instance of the pattern I discussed above: the <em>text</em> is <code>([a-z]+([,-][a-z]+)*|\*)</code>, and the <em>separator</em> is <code>:</code>.</li> </ul> <p>If you plan to use this as a component of an even larger regex, in which the group matches will be important, I would recommend making the internal parens non-grouping, and place grouping parens around the entire regex, like so:</p> <pre><code>((?:[a-z]+(?:[,-][a-z]+)*|\*)(?::([a-z]+)(?:[,-][a-z]+)*|\*)*) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload