Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Markdown
#markdown
#heading
#h1
#h2

Markdown Heading

Matches Markdown ATX-style headings — # through ###### followed by text. Captures both the level (number of #) and the heading text.

Markdown parsersTable of contents generatorsDocumentation tools
/
/
Safe
Test String
4 matches
^^^ — start of string (or line in multiline mode)
(…)Group #1Capturing group — captures matched text for reuse or extraction
#{1,6}#'#' — literal character — repeated between 1 and 6 times · {1,6} — between 1 and 6 times
\s+space\s — whitespace (space, tab, newline…) — repeated one or more times (greedy) · + — one or more times (greedy)
(…)Group #2Capturing group — captures matched text for reuse or extraction
.+.. — matches any character except newline (unless 's' flag is set) — repeated one or more times (greedy) · + — one or more times (greedy)
$$$ — end of string (or line in multiline mode)
Pattern: 17 charsInput: 64 chars
100% client-side · private

Valid Examples

  • # H1 Title
  • ## Section Two
  • ### Subsection
  • ###### Smallest Heading

Invalid Examples

  • #NoSpace
  • ####### Too many hashes
  • Not a heading

Usage & Integration

Validate Markdown Heading natively in your backend or frontend without copying regex strings.

Node / Edge

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

validate('markdown-heading', '...');

Python

from regexto_validators import validate

validate("markdown-heading", "...")

Go

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

valid, err := validators.Validate("markdown-heading", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('markdown-heading', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("markdown-heading", "...").unwrap();