public boolean validateIp(final String ip){
  matcher=pattern.matcher(ip);
  return matcher.matches();
}

public boolean validateIp ( final String ip ) { matcher = pattern . matcher ( ip ) ; return matcher . matches ( ) ; }
validate ip address with regular expression
