Componenteditors1.11 KB gzipZero dependencies
Regex Tester
Regex tester: pattern, test string, highlighted matches and count.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add regex-testerOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { RegexTester } from "@/components/ui/regex-tester"; <RegexTester />Source code
regex-tester.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| pattern | string | Configures pattern. |
| testString | string | Configures test string. (Default: "") |
| onMatch | (matches: string[]) => void | Callback invoked on match. |