File size: 367 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import java.util.regex.*;
public class RegexDemo {
public static void main(String[] args) {
String pattern = "[a-z]+";
String check = "Regular Expressions";
Pattern p = Pattern.compile(pattern);
Matcher c = p.matcher(check);
while (c.find())
System.out.println(check.substring(c.start(), c.end()));
}
}
|