演示Matcher & Pattern的用法
2008-01-05 08:58:44 来源:WEB开发网核心提示:import java.util.regex.Matcher;import java.util.regex.Pattern;public class GetParen0 {public static void main(String[] args) {Pattern myRE = Pattern.compile(&qu
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class GetParen0 {
public static void main(String[] args) {
Pattern myRE = Pattern.compile("d.*ian");
Matcher matcher = myRE
.matcher("darwinian pterodactyls soared over the devonian space");
matcher.lookingAt();
String result = matcher.group(0);
System.out.PRintln(result);
}
}
import java.util.regex.Pattern;
public class GetParen0 {
public static void main(String[] args) {
Pattern myRE = Pattern.compile("d.*ian");
Matcher matcher = myRE
.matcher("darwinian pterodactyls soared over the devonian space");
matcher.lookingAt();
String result = matcher.group(0);
System.out.PRintln(result);
}
}
[]
更多精彩
赞助商链接