import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PatternTest {
public static void main(String[] args) {
String pattern = "[+-]?[0-9]*";
Pattern pat = Pattern.compile(pattern);
Matcher mat = pat.matcher("432");
boolean cb = mat.matches();
if (cb) {
System.out.println("istrue:" + cb);
} else
{
System.out.println("isfalse:" + cb);
}
}
}
import java.util.regex.Pattern;
public class PatternTest {
public static void main(String[] args) {
String pattern = "[+-]?[0-9]*";
Pattern pat = Pattern.compile(pattern);
Matcher mat = pat.matcher("432");
boolean cb = mat.matches();
if (cb) {
System.out.println("istrue:" + cb);
} else
{
System.out.println("isfalse:" + cb);
}
}
}