Windows live writer插入代码图片Test
/** * 验证字符串text是不是ip地址,是返回true,否则返回false * @param text * @return */ public static boolean isIPAddress(String text){ StringBuilder regex = new StringBuilder("^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\."); regex.append("(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."); regex.append("(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."); regex.append("(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$"); if(text.matches(regex.toString())){ //返回判断信息 return true; }else{ return false; } }
![捧腹大笑](http://images0.cnblogs.com/blog/474711/201403/291124054067428.png)