Regex Equivalence Lab

Regex Equivalence Lab

Full-string matching · 95 printable ASCII characters only · not the complete JavaScript regex syntax.

1. Enter two patterns

Supported: ASCII literals, (), |, *, +, ?, ., [abc], [a-z], [^a], \d, \w, \s. Max 120 characters per pattern. ^, $, {m,n}, backreferences and lookarounds are unsupported.

Enter patterns and run comparison.

Comments & questions

Regex Equivalence Lab

Two regexes can agree on a few examples yet differ elsewhere. This tool converts each supported pattern to an NFA and explores combined states to decide language equivalence and inclusion. When they differ, it shows a shortest string accepted by only one side. Matching always covers the whole string; the alphabet is the 95 printable ASCII characters.

Key features

  • Language equivalence and inclusion in both directions
  • Shortest counterexamples for each difference
  • Literals, groups, alternation, repetition and character classes
  • Product-state transition list and Graphviz DOT export
  • Explicit unsupported-syntax and state-limit errors

How to use

  1. Enter two patterns in the supported grammar.
  2. Run the language comparison.
  3. Review inclusion in both directions and quoted witnesses.
  4. Inspect sample product states and transitions.
  5. Download the full JSON or Graphviz DOT graph if needed.

Use cases

  • Check whether a simplified regex accepts exactly the same strings
  • Verify that one allow-rule language is contained in another
  • Find a short test case exposing two patterns' difference

Frequently asked questions

Does this support all JavaScript regex features?

No. It supports printable ASCII literals, groups, |, *, +, ?, dot, character classes and ranges, plus \d, \w and \s. Backreferences, lookarounds, brace quantifiers and anchors are rejected.

What alphabet do dot and negated classes use?

Only the 95 printable ASCII characters U+0020 through U+007E. Newlines and Unicode are outside this language. \s means a space within this alphabet.

How is the empty-string witness shown?

It appears as two quotes, "". No witness is shown with a separate None label.

Does a size limit mean the patterns are equivalent?

No. Hitting the pattern, automaton or product-state limit produces an error and no verdict.

How does this differ from the regex tester?

The tester runs JavaScript regexes against entered sample text. This lab decides a relationship over every string in its stated, limited regular language and finds counterexamples.

Privacy

Patterns are computed in browser memory and are not uploaded. JSON and DOT files download locally.

Related Tools

Regex TesterState Machine TesterMarkdown Repository AuditorWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageXML FormatterHTTP Status Code LookupMIME Type LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorJSON Structure DiffMarkdown Table GeneratorBase64 EncoderJSON FormatterURL EncoderSQL FormatterCron Expression GeneratorUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →