Java tutorial
//package com.java2s; public class Main { public static final boolean isPwd(String str) { if (isBlank(str)) { return false; } return str.matches("^[a-zA-Z]\\w{6,30}$"); } private static boolean isBlank(String str) { if (str == null || str.matches("[ ]{0,}")) { return true; } return false; } }