Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups)

Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups), a VS Code extension by Zovo

Click Test regex above a regex in your code and test it on your own text, beside the editor. Every match is highlighted, each numbered and named group gets its own column, and a replace preview, a railroad diagram and a plain-words explanation come with it. Free, no sign-in, works offline: nothing is sent anywhere.

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-regex-preview, version 0.2.1.

Regex Preview: a TypeScript file with the Test regex link, and the panel with the date pattern, highlighted matches, the groups year, month and day, and a replace preview

Works in JavaScript, TypeScript, Python, Go, Rust, Java, Kotlin, C#, PHP and Ruby files. In any other file, select a pattern and run Test Selected Text as Regex.

Questions people ask

Is Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups) free?

Yes. Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups) is free and MIT licensed.

How do I install Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups)?

Click "Install in VS Code" above, or search for zovo.zovo-regex-preview in the Extensions view.

What it does

Railroad diagram of a semver pattern in the panel

Safe on big text and bad patterns

A catastrophic backtracking pattern stopped after 1 second

Your language features stay as they are

The link above each regex is a CodeLens and nothing more. There is no language server and no TypeScript plugin, so hover, go to definition and errors in TypeScript, Python and the rest work as before. The release check hovers a TypeScript type and runs go to definition with the extension on.

How to use it

  1. Open a source file and click Test regex above a regex. The panel opens beside the editor with the pattern, its flags and its flavor.
  2. Type or paste your text in Sample text, or click Load file.
  3. Look at Matches, Diagram and Explain on the right. Type a replacement to see the replaced text.

Cmd+Alt+M (Ctrl+Alt+M on Windows and Linux) opens the panel with the regex on the cursor line, or with the selected text.

Settings

SettingDefaultWhat it does
regexPreview.codeLenstrueShow Test regex above regexes
regexPreview.codeLensMaxFileKB1024No CodeLens in files larger than this, so big generated files stay fast
regexPreview.timeoutMs1000Time limit for one match run
regexPreview.maxSampleMB10How much of a file is read as sample text
regexPreview.maxMatchRows1000Rows in the match table (all matches are counted)
regexPreview.defaultFlagsgFlags for a new pattern typed in the panel
regexPreview.askForRatingtrueA one-time rating question after you have used it in two sessions
regexPreview.showSupportLinkstrueThe small links at the bottom of the panel

Privacy

No account, no telemetry, no network. The panel's content security policy blocks every network request, and the release check counts 0 requests from it. The sample text and the last pattern are kept in VS Code's workspace storage on your machine. The only links that leave VS Code are the Rate, Sponsor and Marketplace links, and only when you click them.

Limits

Found a pattern that is parsed wrong? Please open an issue with the pattern and the flavor.

Guides

Install Regex Preview & Regex Tester (Railroad Diagram Visualizer, Groups)

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.zovo-regex-preview.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-regex-preview, version 0.2.1.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.

Need your format supported?

Open a format request with a sample file, and I reply there whether it can be done. For USD 299 once, through this GitHub Sponsors tier, I add your file format or a missing feature to this extension, with tests, within 7 days.