What it does
Check that a whole text is a simple slug: lowercase letters and digits separated by single hyphens.
How to use it
- Load the example or paste a slug.
- Check the counterexample.
- Use the whole-text anchors as written.
Verified example
Example
Text "regex-parser"
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: "regex-parser"
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: "regex-parser"
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: "regex-parser"
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: "regex-parser"
Counterexample
Text "-regex"
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: no match
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: no match
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: no match
^[a-z0-9]+(?:-[a-z0-9]+)*$ Result: no match
Recorded by running fixture FX-R07 on : rp.js@1 on Node v24.21.0 (V8), v24.21.0, CPython 3.14.2 (Pyodide 314.0.7), PCRE2 10.48, go1.27.1. JavaScript results come from the rp.js@1 core on Node’s V8; your browser runs the same core.
Engines
- The same pattern runs unchanged in all four engines.
Limits
- No uppercase, underscores, leading or trailing hyphens, or double hyphens.