|
The Matcher class in the java.util.regex package looks for a regular expression in text.
The Java application written below demonstrates the use of the find() and group() methods of
the Matcher class.
import java.util.regex.*;
public class ShowWords {
public static void main(String[] arguments) {
Pattern pattern = Pattern.compile("\\S+");
Matcher matcher = pattern.matcher(arguments[0]);
while (matcher.find())
System.out.println("[" + matcher.group() + "]");
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.