Skip to content
Jellykit

Regex Pattern Library

Tested regular expressions for emails, URLs, IPv4, dates, times, hex colors, UUIDs and postcodes, each explained, with a box to try it.

  • Runs on your device
  • Works in the background
Loading tool

About Regex Pattern Library

Pick a common pattern and get a regular expression you can copy straight into JavaScript, along with a plain account of what it accepts and, just as important, what it does not check. Every pattern here was written for this page and is covered by tests of values it must accept and values it must reject.

Paste your own text to see what the pattern finds, or switch to Check each line to test a list of values one by one, the way a form field would.

How it works

  1. Find in text runs the pattern with the g flag and highlights every match. Check each line wraps it in ^(?: … )$ so that a line passes only if the whole line is one value.
  2. The patterns use no lookbehind, so they work in older Safari too, and none can backtrack exponentially. Long text is still checked in a background worker and stopped after five seconds.
  3. Each pattern lists what it does not check. A regular expression can confirm that a value is shaped right, never that an address, postcode or date really exists.

Questions

Can I use these patterns in Python, PHP or Java?

Mostly yes. They use only features common to the major engines: classes, groups, alternation, counted repeats and \b. Copy the Regex row and add the i flag where the Flags row lists it.

Why does the email pattern reject some valid addresses?

The full standard allows quoted names, comments and IP addresses that almost no real system accepts. This pattern matches the addresses people actually use and keeps false positives in text low. Confirm an address by sending to it.

Why did a five-digit number match the ZIP code pattern?

Any five digits standing alone have the shape of a ZIP code. In free text, look for context such as a state name, or use Check each line on a column you already know holds ZIP codes.

How much text can I try?

Up to 1 MB. Matches are highlighted in texts up to 100,000 characters; the tables show the first 200 matches or 500 lines.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.