Regex by Language
Every programming language handles regular expressions differently. These guides cover language-specific regex syntax, methods, and gotchas with copy-ready code examples.
JavaScript
JavaScript uses the built-in RegExp object for regular expressions. Patterns can be created with literal syntax (/pattern/flags) or the RegExp constructor. The engine supports lookaheads, lookbehinds, named capture groups, and Unicode property escapes.
View guide →Python
Python's re module provides Perl-style regex support. Patterns are typically written as raw strings (r'pattern') to avoid backslash escaping issues. Python 3.11+ added atomic groups and possessive quantifiers.
View guide →Java
Java provides regex support through java.util.regex with the Pattern and Matcher classes. Patterns must be compiled before use, and since Java strings use backslash escaping, regex backslashes need to be doubled (\\d instead of \d).
View guide →Go
Go's regexp package implements RE2 syntax — a guaranteed-linear-time regex engine. This means no backtracking, which makes Go regex safe from catastrophic backtracking (ReDoS) but also means some features like lookaheads and backreferences are not supported.
View guide →PHP
PHP uses PCRE (Perl Compatible Regular Expressions) through the preg_* function family. PCRE is one of the most feature-rich regex engines available, supporting lookaround, backreferences, recursive patterns, and conditional subpatterns.
View guide →Need to test a regex pattern right now? Our tester runs in the browser with instant match highlighting.
← Open the Regex Tester