HubTools

Regex Tester

Test, debug, and understand regular expressions with real-time matching and visual feedback

Real-time TestingVisual HighlightingCode Generator
/
/

Enter a pattern and test string to see results

Options

Find all matches

Ignore case

^ and $ match line breaks

. matches newlines

Enable Unicode support

Matches from lastIndex

Test your regex pattern against the input text. Matches will be highlighted and detailed information provided.

Regex Reference

.Any character except newline
\dDigit (0-9)
\DNot a digit
\wWord character (a-z, A-Z, 0-9, _)
\WNot a word character
\sWhitespace (space, tab, newline)
\SNot whitespace
^Start of string

Click expand to see all 22 patterns

Test History

No history yet. Start testing regex patterns to see them here.

Features

Real-time Testing

See matches instantly as you type with visual highlighting

Multiple Modes

Test matching, replacing, and splitting with the same pattern

Pattern Library

Common regex patterns for emails, URLs, phones, and more

Code Generation

Generate code snippets for JavaScript, Python, Java, and PHP

Test History

Keep track of your recent tests and reload them instantly

Cheat Sheet

Quick reference for regex syntax and special characters

How to Use

  1. Enter your regex pattern in the pattern field
  2. Add test text to match against
  3. Configure flags and options as needed
  4. See real-time results with highlighted matches
  5. Switch between match, replace, and split modes
  6. Generate code snippets for your programming language

Common Use Cases

  • Email Validation: Test email patterns before using in forms
  • Data Extraction: Extract specific patterns from logs or text
  • String Manipulation: Replace or split text based on patterns
  • Input Validation: Validate phone numbers, URLs, dates
  • Code Refactoring: Find and replace code patterns

Regex Flags Explained

  • g (Global): Find all matches, not just the first
  • i (Case Insensitive): Match regardless of case
  • m (Multiline): ^ and $ match line breaks
  • s (Dot All): . matches newline characters
  • u (Unicode): Enable full Unicode support
  • y (Sticky): Match from the last index position