How validate both or either one ?

How validate both or either one ?

I have two text fields in a search form, the user can search by ip1 or by ip2 or by both, I want only the ip address filled to be validated and skip the other one if left empty, I did this but it's still not working :


Thanks, your help is appreciated.