Skip to content

pedrohenrique-ql/vscode-regex-match

Repository files navigation

Regex Match

Create, test and debug regular expressions within a text file

Visual Studio Marketplace Version GitHub Actions Workflow Status Visual Studio Marketplace Installs Visual Studio Marketplace Downloads


Regex Match is a Visual Studio Code extension that enables dynamically creating, testing and debugging regular expressions within a text file. It provides a simple and user-friendly interface, making the process of working with regular expressions effortless and efficient.

Press Ctrl+Alt+X/Cmd+Alt+X or use the command Regex Match: Open Regex Match Window to open the regex test window, where you can test your regular expressions with the help of highlights.

Regex Match Demo

Table of Contents

🚀 Features

Test Regular Expressions

Create, test and debug your regex in a text window. To do this, use the standard format with the regex on the first line of the file with the flags required for your case, plus the test string between the text area delimiters (---).

Testing Regular Expressions

Highlight of Capturing Groups

Each group in a regular expression is highlighted in a different color, making it easy to distinguish and identify them. Color-coded regex capture groups enhance readability and simplify debugging.

Highlight of Capturing Groups

Test Multiple Regular Expressions

You can test multiple regular expressions in the same file. Each regex test works independently, with its own test lines and capture groups. This feature allows you to test different regex patterns in the same place.

Test Multiple Regular Expressions

Test Regular Expressions from the Code Editor

Through VS Code's code lens functionality, Regex Match makes it easy to test the regex present in your code. The code lens will appear above the regex, allowing you to test it in Regex Match window.

Test Regular Expressions from the Code Editor

📝 Release Notes

v0.4.2

  • Fixed the regex detector to detect two or more regex in the same line.
  • Reduced the extension package size by removing unnecessary files.

v0.4.1

  • Fixed Javascript regex detector to avoid detecting comments starting by /*.
  • Fixed the problem of losing the highlights of the regex test when switching tabs in the editor.

v0.4.0

  • Added the functionality to test regex present in the code editor in the regex match window.
  • Created configuration settings to enable/disable the code lens feature.

View the full CHANGELOG.

🛠️ Development

Requirements

The following dependencies are required to run the project:

Dependency Version
Node.js >= 20.11.0 && <21
Visual Studio Code ^1.91.0
pnpm 8.15.3

Usage

  1. Install the dependencies:

    pnpm install
  2. Build the extension:

    pnpm compile
  3. Press F5 to open a new window with the extension loaded.

  4. Press Ctrl+Alt+X/Cmd+Alt+X to open the regex match window.

Testing

To run the interface tests, run the following command:

pnpm test:vsc

To run the unit tests, run the following command:

pnpm test:vi