Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>b*</code> means "match zero or more occurences of <code>b</code>".</p> <p><code>.</code> means "match any character except newline".</p> <p><code>[EE|EJU]</code> means "match an <code>E</code>, a <code>|</code>, a <code>J</code> or a <code>U</code>". </p> <p><code>.*</code> means "match any character except newline zero or more times".</p> <p><code>D</code> means "match a <code>D</code>".</p> <p>So the regex is doing what you asked it to do. </p> <p>From the examples you provided in your question, I'm guessing that the actual rules should be:</p> <ol> <li>String starts with <code>KD-R35</code>.</li> <li>Then any number of alphanumeric characters may follow, as long as</li> <li>there is an <code>E</code>, a <code>J</code> or a <code>U</code> among them, and</li> <li>the string ends in <code>D</code>.</li> </ol> <p>These rules, as a regex, read:</p> <pre><code>^ # start of string KD-R35 # literal text ( # start of capturing group \w* # any number of alphanumeric characters [EJU] # at least one of E, J, or U \w* # any number of alphanumeric characters D # a D ) # end of capturing group $ # end of string </code></pre> <p>or, in JavaScript:</p> <pre><code>match = subject.match(/^KD-R35(\w*[EJU]\w*D)$/i); if (match != null) { // successful match mytext = match[1] // capturing group 1 } else { // Match attempt failed } </code></pre> <p>I'm assuming that upper/lowercase don't matter.</p> <p>EDIT: Erm, your new edit changes the rules. It seems that any string is allowed as long as it starts with <code>KD-R35</code> and ends in <code>D</code>. In this case, the regex would simply be <code>/^KD-R35(\w*D)$/i</code>.</p>
    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