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