Skip to content

Zero-Hassle Regex Extraction & Validation - Test, extract, and validate regular expressions directly inside VS Code with real-time match previews, performance scoring, and built-in ReDoS detection.

License

Notifications You must be signed in to change notification settings

OffensiveEdge/regex-le

Repository files navigation

Regex-LE

Zero-Hassle Regex Extraction & Validation - Test, extract, and validate regular expressions directly inside VS Code with real-time match previews, performance scoring, and built-in ReDoS detection.

Version License

✨ Features

  • πŸ” Test Regex Patterns - Test patterns against your code with detailed match information
  • πŸ“€ Extract Matches - Extract all matches from any file with one command
  • βœ… Validate Patterns - Check regex validity and detect ReDoS vulnerabilities
  • πŸš€ Performance Scoring - Get performance metrics and optimization suggestions
  • πŸ›‘οΈ ReDoS Detection - Built-in protection against Regular Expression Denial of Service attacks
  • πŸ”’ Zero-Hassle Guarantee - Works reliably on all text files with automatic safety checks

πŸš€ Quick Start

  1. Open a file in VS Code (any text file works!)
  2. Press Ctrl+Alt+R (or Cmd+Alt+R on Mac) or search for "Regex-LE: Test Regex"
  3. Enter your pattern (e.g., /\\d+/ to find numbers)
  4. View results with matches, positions, and performance metrics

πŸ“‹ Commands

Test Regex (regex-le.test)

Test a regex pattern against the active editor content with detailed results.

Usage: Ctrl+Alt+R / Cmd+Alt+R or Command Palette β†’ "Regex-LE: Test Regex"

Features:

  • Interactive flag selection (global, case-insensitive, multiline, etc.)
  • Line and column position for each match
  • ReDoS vulnerability warnings
  • Performance scoring and metrics
  • Markdown-formatted results report

Extract Matches (regex-le.extract)

Extract all matches from the active file and display them as a list.

Usage: Command Palette β†’ "Regex-LE: Extract Matches"

Features:

  • Automatic global flag for extraction
  • Clipboard integration (if enabled)
  • Side-by-side results view
  • Progress indication for large files

Validate Pattern (regex-le.validate)

Validate a regex pattern and check for security issues.

Usage: Command Palette β†’ "Regex-LE: Validate Regex"

Features:

  • Pattern syntax validation
  • ReDoS vulnerability detection
  • Performance score calculation
  • Security recommendations

Settings Management

  • Export Settings - Save your configuration to a JSON file
  • Import Settings - Restore settings from a previously exported file
  • Reset Settings - Reset all settings to defaults

πŸ“ Supported File Types

Regex-LE works universally on any text file! Unlike format-specific extractors that require parsers, regex operates directly on text content, making it truly universal.

βœ… Recommended File Types (Zero-Hassle Guaranteed)

Programming Languages

  • JavaScript/TypeScript (.js, .ts, .jsx, .tsx, .mjs, .cjs)
  • Python (.py, .pyw, .pyi)
  • Ruby (.rb, .rake)
  • Go (.go)
  • Rust (.rs)
  • Java (.java)
  • C/C++ (.c, .cpp, .h, .hpp)
  • C# (.cs)
  • PHP (.php)
  • Swift (.swift)
  • Kotlin (.kt)
  • And any other programming language

Data Formats

  • JSON (.json)
  • YAML (.yaml, .yml)
  • TOML (.toml)
  • XML (.xml, .xhtml)
  • CSV (.csv)

Web Technologies

  • HTML (.html, .htm)
  • CSS (.css, .scss, .less, .sass)

Configuration Files

  • Environment (.env, .env.local, .env.production)
  • INI (.ini, .cfg, .conf)
  • Config files (.config, .conf)

Documentation & Text

  • Markdown (.md, .markdown)
  • Plain Text (.txt)
  • Log Files (.log)
  • README files
  • Documentation (.rst, .tex, .org)

Shell & Scripts

  • Shell/Bash (.sh, .bash, .zsh)
  • PowerShell (.ps1)
  • Batch (.bat, .cmd)

How It Works

Regex-LE applies patterns directly to text contentβ€”no format parsing required. This means:

βœ… Works on any text file VS Code can open
βœ… No format-specific limitations
βœ… Safety checks handle edge cases (binary detection, size limits)
βœ… Reliable results guaranteed by Zero-Hassle design

Safety Features

Regex-LE automatically protects you:

  • πŸ›‘οΈ Binary file detection - Blocks processing of binary files
  • πŸ“ Size limits - Warns before processing very large files
  • ⚠️ ReDoS detection - Warns about vulnerable patterns
  • 🚦 Match limits - Prevents excessive memory usage

Examples by File Type

JavaScript/TypeScript - Extract function names:

// Pattern: /\bfunction\s+(\w+)/g
// Matches: function declarations

JSON - Extract all string values:

// Pattern: "([^"]+)"
// Matches: All JSON string values

HTML - Extract all URLs:

<!-- Pattern: https?://[^\s"<>]+ -->
<!-- Matches: All HTTP/HTTPS URLs -->

CSV - Extract email addresses:

// Pattern: [\w.-]+@[\w.-]+\.\w+
// Matches: Email addresses in any column

Log Files - Extract timestamps:

// Pattern: \d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}
// Matches: ISO 8601 timestamps

βš™οΈ Configuration

Regex-LE has minimal configuration to keep things simple. Most settings are available in VS Code's settings UI under "Regex-LE".

Key Settings

  • regex.realtimePreviewEnabled - Enable real-time regex preview (future feature)
  • regex.redosDetectionEnabled - Enable ReDoS vulnerability detection
  • regex.maxMatchLimit - Maximum matches to return (default: 1000)
  • copyToClipboardEnabled - Auto-copy extraction results
  • openResultsSideBySide - Open results side-by-side
  • notificationsLevel - Control notification verbosity (all, important, silent)
  • safety.enabled - Enable safety checks for large files
  • performance.enabled - Enable performance monitoring

For the complete list, open VS Code Settings and search for "regex-le".

Settings Management

  • Export - Save your configuration to share or backup
  • Import - Restore settings from a file
  • Reset - Restore all settings to defaults

All settings files are validated for security and safety.

🌍 Language Support

13 languages: English, German, Spanish, French, Indonesian, Italian, Japanese, Korean, Portuguese (Brazil), Russian, Ukrainian, Vietnamese, Chinese (Simplified)

🧩 System Requirements

  • VS Code: 1.70.0 or higher
  • Platform: Windows, macOS, Linux
  • Node.js: 20.0.0+ (bundled with VS Code)

πŸ”’ Privacy & Security

  • 100% local processing - No data leaves your machine
  • No network requests - Everything runs locally
  • Optional telemetry - Local-only logging when enabled
  • Secure settings import - Validated against schema to prevent malicious configurations
  • ReDoS protection - Built-in vulnerability detection

🎯 Zero-Hassle Guarantee

Regex-LE is designed to "just work" without complications:

βœ… Universal text support - Works on any file VS Code can open as text
βœ… Automatic safety checks - Binary files, size limits handled automatically
βœ… Graceful error handling - Clear messages, not cryptic errors
βœ… Performance protection - Match limits prevent resource exhaustion
βœ… ReDoS awareness - Warns about vulnerable patterns before execution

Unlike format-specific extractors (which require parsers for each file type), regex operates on raw textβ€”making it truly universal while maintaining reliability.

πŸ†š Comparison with Other LE Extensions

Feature Regex-LE Paths-LE Secrets-LE
File Type Support βœ… Any text file ⚠️ 9 specific types ⚠️ Multiple types
Format Parsing ❌ Not needed βœ… Required ❌ Regex-based
Zero-Hassle βœ… Universal ⚠️ Format-limited βœ… Works on text
Custom Patterns βœ… User-defined ❌ Fixed patterns ⚠️ Pre-defined

Key Insight: Regex-LE offers maximum flexibilityβ€”you define the pattern, and it works universally.

πŸ“š Learn More

  • Performance Guide - Learn about regex performance optimization
  • ReDoS Detection - Understanding Regular Expression Denial of Service
  • File Type Analysis - See docs/FILE_TYPE_ANALYSIS.md for detailed file type support analysis

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

πŸ“ License

MIT License - See LICENSE file for details.

πŸ™ Acknowledgments

Built with patterns from the LE extension family:

  • Paths-LE, Secrets-LE, Numbers-LE, Dates-LE, URLs-LE, Strings-LE, EnvSync-LE, Scrape-LE

πŸ“ž Support


Made with ❀️ by OffensiveEdge

About

Zero-Hassle Regex Extraction & Validation - Test, extract, and validate regular expressions directly inside VS Code with real-time match previews, performance scoring, and built-in ReDoS detection.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published