Possessive quantifiers
Java supports ++, *+, ?+.
Fix: Rewrite using atomic groups or simulate manually.
header • up to 320x100 / 728x90
Test Java-style regular expressions with ECMAScript-equivalent matching and group capture
Output will appear here...
content bottom • up to 300x250
sidebar • 160x600
Last reviewed:
Java is a statically typed, object-oriented language used heavily in enterprise backends, Android development, and large-scale distributed systems.
Java Regex Tester evaluates Java-flavoured regular expressions against a sample string. Pattern goes on line 1, test text on the remaining lines. Matches, their positions, and captured groups are listed for quick debugging.
The underlying engine is the browser's RegExp, which covers the 95% of Java regex semantics (character classes, quantifiers, alternation, groups, named groups, lookahead) — with a note about the edge cases Java supports natively (possessive quantifiers, \A, \Z, wider lookbehind).
\b(\w+)@(\w+\.\w+)\b Reach us at [email protected] and [email protected]
Java regex (ECMAScript-equivalent): /\b(\w+)@(\w+\.\w+)\b/g Test text: 52 chars [0] "[email protected]" at 12 groups: [support, example.com] [1] "[email protected]" at 36 groups: [sales, example.co] Note: Java regex supports a few features (possessive quantifiers, \A, \Z, lookbehind widths) that this tester approximates using JavaScript's engine. Results should match for the common 95% case.
Java supports ++, *+, ?+.
Fix: Rewrite using atomic groups or simulate manually.
Copy-paste from Java source doubles backslashes.
Fix: Replace \\ with \ before pasting.
For the common 95% of features, yes. Edge cases (\A, \Z, possessive quantifiers, variable-width lookbehind) use JavaScript's approximations.
g, i, m, s, u, y (standard JavaScript flags).
Yes — (?<name>pattern) works on modern browsers.
No — the tester runs entirely in your browser.
Yes — put the pattern on line 1 and multi-line text after.
Pair the Java regex tester with the general regex tester, cheat sheet, and formatter. You can also browse the full Validators category for more options.
Test and debug regular expressions
Generate regular expressions from patterns
Format and beautify Java code online with proper indentation and Java conventions. Paste Java code and get clean, readable output following standard Java style.
Round-trip Java string literals — escape quotes, backslashes, newlines, and Unicode sequences
Escape or unescape JavaScript string literals with backslash, quote, Unicode, and control-character handling
Score password strength with length, character variety, repeated-pattern checks, and practical suggestions for safer credentials.
Validate credit card numbers with the Luhn algorithm and detect card type online without storing the number you enter.
Validate CSS syntax online and catch parse errors in stylesheets with instant feedback for malformed rules and blocks.
Edit Java code with syntax highlighting and a split-view inspector for source, structure, and quick review.
Escape strings for Java
Validate JavaScript syntax online and catch parse errors, missing brackets, and malformed statements with instant feedback.
Validate JSON syntax and catch parse errors instantly. Paste JSON and get immediate feedback on structural issues, missing commas, and unquoted keys.