find a ip address in a string java code example Example: java ip regex pattern String pattern = "([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])";