Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this (<a href="http://www.rubular.com/r/SYIlg16mHn" rel="nofollow noreferrer">see also on rubular.com</a>):</p> <p><code>^(\d{13})?$</code></p> <p>Explanation:</p> <ul> <li><code>^</code>, <code>$</code> are beginning and end of string anchors</li> <li><code>\d</code> is the character class for digits</li> <li><code>{13}</code> is exact finite repetition</li> <li><code>?</code> is "zero-or-one of", i.e. optional</li> </ul> <h3>References</h3> <ul> <li><a href="http://www.regular-expressions.info/anchors.html" rel="nofollow noreferrer">regular-expressions.info/Anchors</a>, <a href="http://www.regular-expressions.info/charclass.html" rel="nofollow noreferrer">Character Classes</a>, <a href="http://www.regular-expressions.info/repeat.html" rel="nofollow noreferrer">Repetition</a>, <a href="http://www.regular-expressions.info/optional.html" rel="nofollow noreferrer">Optional</a></li> </ul> <hr> <h3>On the definition of empty</h3> <p>The above pattern matches a string of 13 digits, or an empty string, i.e. the string whose length is zero. If by "empty" you mean "blank", i.e. possibly containing nothing but whitespace characters, then you can use <code>\s*</code> as an alternation. Alternation is, simply speaking, how you match <code>this|that</code>. <code>\s</code> is the character class for whitespace characters, <code>*</code> is "zero-or-more of" repetition.</p> <p>So perhaps something like this (<a href="http://www.rubular.com/r/Rsdagsp0wt" rel="nofollow noreferrer">see also on rubular.com</a>):</p> <p><code>^(\d{13}|\s*)?$</code></p> <h3>References</h3> <ul> <li><a href="http://www.regular-expressions.info/alternation.htm" rel="nofollow noreferrer">regular-expressions.info/Alternation</a></li> </ul> <h3>Related question</h3> <ul> <li><a href="https://stackoverflow.com/questions/3012788/regex-check-if-a-line-is-blank-or-not/">regex, check if a line is blank or not</a></li> </ul>
    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