java.util.regex.Matcher.matches()のサンプル
Javaコード
package com.arkgame.study;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test004 {
public static void main(String[] args) {
Pattern pattern = Pattern.compile(“[0-9]+");
Matcher cc = pattern.matcher(“6789tokyo");
System.out.println(cc.matches());
Matcher dd = pattern.matcher(“12345");
System.out.println(dd.matches());
}
}
結果
false
true