← DevHelpers|Guide: Regex Basics and Testing

Regex Basics and Testing

Regular expressions (regex) are powerful patterns used for matching text. This guide covers the basics and how to test your patterns.

Basic Patterns

  • . - Matches any single character
  • * - Matches 0 or more of the preceding character
  • + - Matches 1 or more of the preceding character
  • ? - Matches 0 or 1 of the preceding character
  • ^ - Matches the start of a string
  • $ - Matches the end of a string

Character Classes

  • [abc] - Matches any character in the set
  • [^abc] - Matches any character NOT in the set
  • \d - Matches any digit (0-9)
  • \w - Matches any word character
  • \s - Matches any whitespace

Common Flags

  • g - Global: find all matches
  • i - Case-insensitive matching
  • m - Multiline mode

Testing Your Regex

Use our Regex Tester to:

  1. Enter your regex pattern
  2. Select appropriate flags
  3. Add test text
  4. See matches and capture groups highlighted