πŸ“š Reference

Regex Pattern Library

100+ tested regular expression patterns organized by category. Search, copy and test any pattern instantly. Click any pattern to open it in the Regex Tester.

What is a Regex Pattern Library?

A regex pattern library is a curated collection of pre-tested regular expressions for common validation and extraction tasks. Instead of writing and debugging a pattern from scratch every time you need to validate an email address or extract an IP from a log line, you can grab a proven, edge-case-aware pattern in seconds. This library covers the patterns DevOps engineers reach for most often: network addresses, cloud resource identifiers, security tokens, date formats and more.

Regular expressions are one of the most reused tools in a developer's toolkit, yet they're also notoriously easy to get wrong. A subtly broken email regex can let invalid addresses through, and a poorly anchored IP pattern can match garbage inside longer strings. Every pattern here has been validated against both matching and non-matching examples, so you can drop it into production code with confidence.

When to Use This Tool

How It Works

All patterns in this library use PCRE-compatible syntax, the standard supported by Python, JavaScript, Java, Go (with RE2 caveats), PHP, Ruby and most DevOps tools including grep, sed, nginx and Kubernetes admission controllers. Each pattern card shows the regex, a plain-English description and example matches and non-matches so you can verify it fits your specific case before copying it.

Frequently Asked Questions

Are these regex patterns tested?

Yes. Every pattern has been tested against both valid inputs it should match and invalid inputs it should reject. The example lines on each card show representative matches and rejections. For complete confidence, click any pattern to copy it and then paste it into the Regex Tester tool on this site to run it against your own sample data before committing to production.

How do I use these patterns in Python, JavaScript or Java?

Copy the pattern and pass it to your language's regex engine. In Python, use re.compile(r'pattern') with an r-string prefix to avoid double-escaping backslashes. In JavaScript, use new RegExp('pattern') or a regex literal /pattern/. In Java, use Pattern.compile("pattern"). In Go, use regexp.MustCompile(`pattern`) with a raw string literal. All patterns use standard syntax compatible with these engines.

What is the difference between anchored and unanchored regex patterns?

Anchored patterns use ^ (start of string) and $ (end of string) to force a full-string match β€” ideal for validating form fields where the entire input must conform to the format. Unanchored patterns match anywhere inside the text, making them suited for extraction tasks like pulling an IP address from the middle of a log line. Most patterns here are unanchored so they work as extractors; add ^ and $ when you need strict full-string validation.