Programming Languages
Regex pattern implementations across popular programming languages. Each pattern is optimized for the specific features and syntax of each language.
Most Popular Languages
All Languages
JavaScript
Modern JavaScript/ES6+ regex patterns with full Unicode support and named capture groups.
Key Features:
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); // truePHP
PHP regex patterns with PCRE support for web development and text processing.
Key Features:
HTML Tag Removal Example:
<?php
$html = '<p>Hello <strong>world</strong>!</p>';
$pattern = '/<[^>]*>/';
$clean = preg_replace($pattern, '', $html);
echo $clean; // "Hello world!"
?>Python
Python regex patterns using the re module with comprehensive Unicode support.
Key Features:
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#
.NET regex patterns with Regex class for enterprise applications.
Key Features:
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); // trueJava
Java regex patterns with Pattern and Matcher classes for robust string processing.
Key Features:
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); // trueRust
Rust regex patterns with memory safety and performance optimization.
Key Features:
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
Go regex patterns with regexp package for system programming and APIs.
Key Features:
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
| Language | Engine | Unicode | Lookbehind | Named Groups | Patterns |
|---|---|---|---|---|---|
🟨JavaScript | V8/SpiderMonkey | ✓ Full | ✓ Yes | ✓ Yes | 152 |
🐘PHP | PCRE | ✓ Full | ✓ Yes | ✓ Yes | 107 |
🐍Python | PCRE | ✓ Full | ✓ Yes | ✓ Yes | 49 |
🔷C# | PCRE | ✓ Full | ✓ Yes | ✓ Yes | 42 |
☕Java | java.util.regex | ✓ Full | ✓ Yes | ✓ Yes | 34 |
🦀Rust | regex | ✓ Full | ✓ Yes | ✓ Yes | 4 |
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.