Are there any trailing whitespace characters in the url_hostname
field?
Also, your regular expression will only match the first example ( 1.2.3.4
) but not the second (1.2.3.4:6666
).
Additionally, I just see the to_ip
function in your condition, which is wrong there. Regular expressions only work on strings, not IP addresses (the data type, not if a string contains an IP address).