Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Align RegexNew to Visual Studio Code? Get it now.
Align Regex

Align Regex

thangckt

|
46 installs
| (1) | Free
Aligns text lines by a regular expression.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Align Regex

This extension is originally based on vscode-align-by-regex

It allows you to align multiple lines of text using regular expressions. You can easily align trailing comments, key-value pairs, or any custom text pattern you define.

Features

  • Regex-Based Alignment: Align multiple lines of text simultaneously using powerful regular expressions.
  • Versatile Formatting: Effortlessly handle trailing comments, assignment operators, key-value pairs, and complex code structures.
  • Fully Customizable: Define and save custom regex patterns as reusable templates to match your expectation.
  • Seamless Editor Integration: Run alignment commands instantly from the editor's context menu.
  • Multi-Cursor Support: Align multiple independent line selections and cursors at the same time.

Extension Settings

  • align.regex.templates: Templates for regular expressions used for alignment. The default built-in templates are:
{
    "align.regex.templates": {
        "Multiple signs": "=|,|:",
        "Trailing comments #": "(?<=\\S.*)\\s+#",
        "Trailing comments //": "(?<=\\S.*)\\s+//",
        "Trailing comments %": "(?<=\\S.*)\\s+%",
    }
}

Usage

  • Select multiple lines or multiple cursors
  • Right-click on the editor, and choose Align Regex
  • Select templates or input Regular Expression.

Example 1

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft