Regular Expression Testing Tool

Found 0 matches

Java Code Example

Common Examples

Email Address

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Phone Number

1[3-9]\d{9}

Website URL

https?:\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?

ID Card Number

[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9X]

Date Format

\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])

IPv4 Address

((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)

Test regular expressions live: matches are highlighted as you type, capture groups are listed separately, and a copyable Java snippet is generated.

Reading the results

Once you enter a pattern and test text, every match is highlighted and counted in real time. Expressions with capture groups list each group's contents separately, which is the quickest way to confirm that your parentheses group what you meant. Results refresh as you edit — no run button.

Common traps

Greedy .* swallows the whole line; .*? stops at the nearest match. Without the g flag only the first hit matches. The dot does not cross newlines unless you enable m or use [\s\S]. All of these can be checked live on the page.

Frequently asked questions

Which regex engine is used?
The JavaScript (ECMAScript) engine. Syntax is close to Java and Python, but named groups and lookbehind differ — verify before porting a pattern.
Does it generate code?
Yes, a Java Pattern/Matcher example is shown below the results and can be copied directly.
Is my test text uploaded?
No, matching runs in the browser.