Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Web
#html
#tag
#web
#parsing

HTML Tag

Matches an HTML opening or self-closing tag with optional attributes.

HTML sanitizationTemplate parsingWeb scraping
/
/
Safe
Test String
3 matches
<<'<' — literal character
(…)Group #1Capturing group — captures matched text for reuse or extraction
[…]Character class […]Matches any single character listed in this set
[…]*Character class […]Matches any single character listed in this set — repeated zero or more times (greedy) · * — zero or more times (greedy)
\bboundary\b — word boundary (zero-width)
[…]*Negated class [^…]Matches any single character NOT listed in this set — repeated zero or more times (greedy) · * — zero or more times (greedy)
^^^ inside [ — negates the class
>>'>' — literal character
\/?\/\/ — escaped character '/' — repeated zero or one time (optional) · ? — zero or one time (optional)
>>'>' — literal character
Pattern: 34 charsInput: 82 chars
100% client-side · private

Valid Examples

  • <div>
  • <img src="photo.jpg" alt="Photo" />
  • <input type="text" class="form-control">

Invalid Examples

  • </div>
  • <!-- comment -->
  • <123invalid>

Usage & Integration

Validate HTML Tag natively in your backend or frontend without copying regex strings.

Node / Edge

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

validate('html-tag', '...');

Python

from regexto_validators import validate

validate("html-tag", "...")

Go

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

valid, err := validators.Validate("html-tag", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('html-tag', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("html-tag", "...").unwrap();