replaced logic with regex to math ip adress