this is the code I use but I can't set EXP2 to limit the number under the 256. Does anybody help?
P.S.
EXP1 validate a domain name (es. www.myserver.com)
EXP2 may validate IP address (es. 111.111.111.0)
code:
public static boolean isServerAddress(String s){ System.out.print(s + " "); String EXP1 ="([a-zA-Z0-9]+).([a-zA-Z0-9]+).([a-zA-Z]{2,3})|([a-zA-Z0-9]+).([a-zA-Z0-9]+).([a-zA-Z]{2,3}).([a-zA-Z]{2,3}+)"; String EXP2 ="([0-9]{1,3}+).([0-9]{1,3}+).([0-9]{1,3}+).([0-9]{1,3})"; if(Pattern.matches(EXP1, s)){ return true; }else if(Pattern.matches(EXP2, s)){ return true; }else{ return false; } }