hs.hsadmin/hsarback/test/de/hsadmin/validate/PacName.java
2015-12-28 20:07:00 +01:00

21 lines
799 B
Java

package de.hsadmin.validate;
import java.util.regex.Pattern;
public class PacName {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("[a-z0-9]{5}-[a-z0-9\\.\\_]{1,}");
System.out.println("xyz00-a.b " + pattern.matcher("xyz00-a.b").matches());
System.out.println("xyz00-a-b " + pattern.matcher("xyz00-a-b").matches());
System.out.println("xyz00-a.B " + pattern.matcher("xyz00-a.B").matches());
System.out.println("xyz00- " + pattern.matcher("xyz00-").matches());
System.out.println("xyz00 " + pattern.matcher("xyz00").matches());
System.out.println("xyz0 " + pattern.matcher("xyz0").matches());
System.out.println("xyz00_a " + pattern.matcher("xyz00_a").matches());
System.out.println("xyz00-a.b:c " + pattern.matcher("xyz00-a.b:c").matches());
}
}