You are viewing a single comment's thread. Return to all comments →
class MyRegex{ String ip; MyRegex(String ip){ this.ip= ip; } public static boolean checkIP(String ip){ String[] ipArr= ip.split("\\."); if(ipArr.length!=4){ return false; } for(String i: ipArr){ try{ if(i.length()>3){ return false; } int num= Integer.parseInt(i); if(!(num>= 0 && num<= 255)){ return false; } } catch(Exception ex){ return false; } } return true; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Regex
You are viewing a single comment's thread. Return to all comments →