Regex Tester

Validate your regular expressions with real-time matching, detailed group analysis, and syntax highlighting.

//
g

Flags

Global (g)

Don't return after first match

Multiline (m)

^ and $ match strat/end of line

Case Insensitive (i)

Case-insensitive matching

Match Information

0

Matches

0

Groups

No results found.

helpQuick Reference

  • .Any Character
  • \wWord Character
  • \dAny Digit
  • \sWhitespace
  • [abc]Character Class
  • (...)Capture Group
  • ^ / $Start / End
  • * / +Zero+ / One+

starMost Popular Regexes

Email Address

Matches standard email addresses.

/^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$/g

URL / Website

Matches HTTP and HTTPS URLs.

/^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$/g

IPv4 Address

Validates an IPv4 address.

/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g

Phone Number (US)

Matches US phone numbers, including extensions.

/^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$/g

Strong Password

1 uppercase, 1 lowercase, 1 number, 1 special char, 8+ length.

/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/g

Hex Color

Matches 3 or 6 digit hex color codes.

/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/g

Frequently Asked Questions

What is a Regular Expression (Regex)?

A regular expression, often called regex or regexp, is a sequence of characters that forms a search pattern. It is used extensively in programming and text editors for finding, validating, and replacing strings that match specific patterns.

What are capture groups?

Capture groups, denoted by parentheses (), let you group parts of your pattern together. This allows you to apply quantifiers to the entire group or extract the specific text matched by that group for later reporting or replacement.

What do the regex flags mean?

Flags modify how the regex engine executes the search. For example, the Global flag (g) matches all occurrences instead of stopping at the first, Case-Insensitive (i) ignores uppercase/lowercase differences, and Multiline (m) changes the behavior of ^ and $ to match the start and end of each line respectively.

Is this regex tester safe?

Yes! All processing happens completely locally in your client. Your regex patterns and test strings are never sent to external servers, making it totally safe for testing patterns with sensitive operational data.