Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Web
#slug
#url
#web
#cms

URL Slug

Valid URL slug — lowercase alphanumeric characters separated by single hyphens, no leading or trailing hyphens.

✓ CMS permalink generation✓ URL route validation✓ SEO slug sanitization
/
/
Safe
Test String
4 matches
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
a-za-z— a-z — range from 'a' to 'z'
0-90-9— 0-9 — range from '0' to '9'
(?:…)*Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or more times (greedy) · * — zero or more times (greedy)
--— '-' — literal character
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
Pattern: 24 charsInput: 39 chars
100% client-side · private

✓ Valid Examples

  • my-blog-post
  • hello
  • article-123
  • regex-to

✗ Invalid Examples

  • My-Post
  • -starts-with-hyphen
  • ends-with-hyphen-
  • has--double

Usage & Integration

Validate URL Slug natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('slug', '...');

Python

from regexto_validators import validate

validate("slug", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("slug", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('slug', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("slug", "...").unwrap();