Last updated: 3 min ago

Programming Languages

Regex pattern implementations across popular programming languages. Each pattern is optimized for the specific features and syntax of each language.

7 languages • 500 total patterns

Most Popular Languages

All Languages

🟨

JavaScript

152 patterns
95%

Modern JavaScript/ES6+ regex patterns with full Unicode support and named capture groups.

Key Features:

Named Capture Groups
Unicode Property Escapes
Lookbehind Assertions
Dotall Flag

Email Validation Example:

const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const isValid = emailRegex.test('user@example.com');
console.log(isValid); // true
🐘

PHP

107 patterns
68%

PHP regex patterns with PCRE support for web development and text processing.

Key Features:

PCRE Functions
Named Subpatterns
Modifiers
Callback Support

HTML Tag Removal Example:

<?php
$html = '<p>Hello <strong>world</strong>!</p>';
$pattern = '/<[^>]*>/';
$clean = preg_replace($pattern, '', $html);
echo $clean; // "Hello world!"
?>
🐍

Python

49 patterns
88%

Python regex patterns using the re module with comprehensive Unicode support.

Key Features:

Named Groups
Verbose Mode
Unicode Categories
Conditional Patterns

Phone Number Extraction Example:

import re

phone_pattern = r'\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})'
text = "Call me at (555) 123-4567"
match = re.search(phone_pattern, text)
if match:
    print(f"Found: {match.group()}")
🔷

C#

42 patterns
62%

.NET regex patterns with Regex class for enterprise applications.

Key Features:

Compiled Regex
Timeouts
Right-to-Left
Assembly Generation

Credit Card Validation Example:

using System.Text.RegularExpressions;

string pattern = @"^[0-9]{13,19}$";
Regex regex = new Regex(pattern);
bool isValid = regex.IsMatch("4111111111111111");
Console.WriteLine(isValid); // true

Java

34 patterns
75%

Java regex patterns with Pattern and Matcher classes for robust string processing.

Key Features:

Pattern Compilation
Matcher Groups
Scanner Integration
Stream Support

URL Validation Example:

import java.util.regex.Pattern;

String urlPattern = "^https?://[\\w.-]+\\.[a-zA-Z]{2,}(/.*)?$";
Pattern pattern = Pattern.compile(urlPattern);
boolean isValid = pattern.matcher("https://example.com").matches();
System.out.println(isValid); // true
🦀

Rust

4 patterns
42%

Rust regex patterns with memory safety and performance optimization.

Key Features:

Memory Safe
Zero Cost
Unicode Support
Compile Time

Hex Color Example:

use regex::Regex;

fn main() {
    let re = Regex::new(r"^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$").unwrap();
    println!("{}", re.is_match("#FF5733")); // true
}
🐹

Go

0 patterns
55%

Go regex patterns with regexp package for system programming and APIs.

Key Features:

RE2 Engine
Submatch
Compile Once
Thread Safe

IPv4 Address Example:

package main

import "regexp"

func main() {
    pattern := `^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$`
    matched, _ := regexp.MatchString(pattern, "192.168.1.1")
    println(matched) // true
}

Language Comparison

LanguageEngineUnicodeLookbehindNamed GroupsPatterns
🟨JavaScript
V8/SpiderMonkey✓ Full✓ Yes✓ Yes152
🐘PHP
PCRE✓ Full✓ Yes✓ Yes107
🐍Python
PCRE✓ Full✓ Yes✓ Yes49
🔷C#
PCRE✓ Full✓ Yes✓ Yes42
Java
java.util.regex✓ Full✓ Yes✓ Yes34
🦀Rust
regex✓ Full✓ Yes✓ Yes4

Missing Your Language?

We're always looking to add support for more programming languages. Contribute patterns for your favorite language and help expand our library.