Componenteditors1.11 KB gzipZero dependencies

Regex Tester

Regex tester: pattern, test string, highlighted matches and count.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add regex-tester

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { RegexTester } from "@/components/ui/regex-tester"; <RegexTester />

Source code

regex-tester.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxregex-tester.tsx107 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface RegexTesterProps extends React.HTMLAttributes<HTMLDivElement> {  pattern?: string;  testString?: string;  onMatch?: (matches: string[]) => void;} function hasNestedQuantifiers(pattern: string): boolean {  if (pattern.length > 200) return true;  if (/(\([^)]*[+*][^)]*\))[+*{]/.test(pattern)) return true;  return false;} /** Regular expression tester: pattern + test string + match highlights. */

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { RegexTester } from "@/components/ui/regex-tester"; <RegexTester />
PropTypeDescription
patternstringConfigures pattern.
testStringstringConfigures test string. (Default: "")
onMatch(matches: string[]) => voidCallback invoked on match.