applications – Filter users input


I have edittext with button , I want user to input only address IP with subnet mask and nothing else e.g. 10.0.0.0/24 , if user enter something else I want to notify him, is there a code to help me with that?

enter image description here