Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class CheckHatenaID {
public static void main (String[] args) {
String hatenaID = "shogonir";
Pattern p = Pattern.compile("[a-zA-Z][a-zA-Z0-9_\\-]{1,30}[a-zA-Z0-9]");
Matcher m = p.matcher(hatenaID);
boolean f = m.matches();
System.out.println(String.valueOf(f));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.