I am using below regular expression pattern
pattern=\"^(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d|1\\d\\d|2([0-4]\\d|5[0-5]))\\.(\\d|[1-9]\\d
this should work
^((2([0-4]\d|5[0-5])|1\d\d|[0]?[1-9]\d|[0]?[0]?\d)(\.(2([0-4]\d|5[0-5])|1\d\d| [0]?[1-9]\d|[0]?[0]?\d)){3}([\s,](?!$)|$))*$
it will accept comma separated and space separated ips