"\\d+", check “Pattern is Java string literal” so it tests as \d+.
How to use
Use it like a quick Pattern + Matcher sandbox.
- Enter your regex in Pattern. If you copied it from Java source code (double slashes), enable Pattern is Java string literal.
- Paste your test text in Text (optionally unescape as Java string literal).
- Select flags (Case-insensitive / Multiline / Dotall / Unicode) and choose Find all if you want every match.
- Click Test to see matches and groups. Use Replace All / Replace First to preview replacements.
FAQ
Is this running real Java Pattern/Matcher?
No. It runs in your browser using JavaScript RegExp, plus helpers for Java string-literal unescaping and a Java code snippet.
Why does my Java regex behave differently here?
Some Java-only features (like inline flags, possessive quantifiers, or tokens like \A/\Z) may not be supported or may differ in JavaScript.
What does “Pattern is Java string literal” mean?
If you copied from Java code (e.g., "\\d+"), enable it so the tool converts \\ into a single backslash before testing.
Which flags correspond to Java Pattern flags?
i ≈ CASE_INSENSITIVE, m ≈ MULTILINE, s ≈ DOTALL. The u flag enables Unicode mode in JavaScript and may affect character classes.
Does “Find all” match Java’s find() loop?
Yes, it approximates repeated m.find() by using global matching and listing each match with captured groups.
How do I test replaceAll vs replaceFirst?
Use Replace All to replace every match (like Java replaceAll) and Replace First for only the first occurrence.
How many matches will it list?
It caps output to keep the page fast (up to 200 matches) and applies a short time guard for very expensive patterns.