Online Java Formatter

Help Tutorials Coding Ground View Edit Dev Tools
Online Image Optimizer
Online LaTex Editor
LaTex Equation Editor
Whiteboard
Online Image Editor
Online XML Editor
Online JSON Editor
File Conversion
More Tools...
Undo
Redo
Cut
Copy
Paste
Delete
Select All
Find
Find and Replace
Editor Theme
Chrome
Crimson Editor
Dreamweaver
Eclipse
Github
Kuroir
Solarized Light
Solarized Dark
XCode
Ambiance
Cobalt
idle Fingers
krTheme
Mono Industrial
Monokai
Terminal
Textmate
Tomorrow
Twilight
Vibrant Ink
Font Size
8px
9px
10px
11px
12px
13px
14px
15px
16px
17px
18px
20px
22px
24px
Tab Size
1
2
3
4
5
6
7
8
Soft Wrap
On
Off
40 Chars
60 Chars
80 Chars
100 Chars
120 Chars
140 Chars
Show Invisible
Hide Invisible
Show Gutter
Hide Gutter
Download
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches
{
public static void main( String args[] ){

// String to be scanned to find the pattern.
String line = "This order was placed for QT3000! OK?";
String pattern = "(.*)(\\d+)(.*)";

// Create a Pattern object
Pattern r = Pattern.compile(pattern);

// Now create matcher object.
Matcher m = r.matcher(line);
if (m.find( )) {
System.out.println("Found value: " + m.group(0) );
System.out.println("Found value: " + m.group(1) );
System.out.println("Found value: " + m.group(2) );
} else {
System.out.println("NO MATCH");
}
}
}
Beautify | upload files Upload File