Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>/^[a-z0-9]+#[a-z0-9]+$/i</code> should do the trick.</p> <p><code>/^[a-z0-9]+(#[a-z0-9]+)?$/i</code> if the '#' is optional</p> <p><code>[a-z0-9]+</code> means one or more letter or number (the <code>+</code> means one or more)</p> <p><code>(#[a-z0-9]+)?</code> means a '#' followed by the above, but the whole thing either zero or one times (<code>?</code> means zero or one)</p> <p>The <code>^</code> and <code>$</code> anchor the whole thing at the beginning and end</p> <p>The <code>i</code> means case-insensitive</p> <p>Thus, this will match one or more alphanum, optionally followed by a '#' and then one or more alphanums.</p> <p>If you want more '#' characters, you could use <code>/^[a-z0-9]+([#a-z0-9]+[a-z0-9])?$/i</code> instead. This will match one or more alphanum, optionally followed by one or more '#' or alphanums, and then an alphanum.</p> <p>You could also use <code>\w</code> for alphanumeric characters. Notice, however, that this is the same as <code>[a-zA-Z0-9_]</code>, and would allow the <code>_</code> underscore character. If you do not want the underscore, you should stick with <code>[a-zA-Z0-9]</code> (or <code>[a-z0-9]</code> with the <code>i</code>)</p> <p><strong>EDIT</strong> saw you wanted spaces. try this (it worked with all of my tests):</p> <pre><code>/^[a-z0-9]+(([#a-z0-9\s]+)?[a-z0-9])?$/i </code></pre> <p>Note about this: It does not allow spaces at the beginning and end, but will allow consecutive spaces. It will allow optional '#' characters, and any number of them. <code>\s</code> means whitespace</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. This table or related slice is empty.
    1. 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