-
Notifications
You must be signed in to change notification settings - Fork 33
Description
The regex for validating IP addresses, which is used in several of the models, fails to match and returns a ValueError when a valid IP address is passed to it. I isolated it down to the double backslash, which I understand being there, as the first escapes the second and the second escapes the dot, meaning it is interpreted as a literal dot. However, when i tested it, the regex does not work with the double backslash, but it does work with a single backslash.
^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])(\\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])){3}$|^[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5}::([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?$|^[0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){7}$
IP regex is used in following models:
cluster_email_extended
cluster_email_settings
diagnostic_gather_settings_extended
diagnostic_gather_settings_settings
subnets_subnet_pool_range
subnets_subnet_static_route
Similarly, the regex used to match dns zones in several models also contains a double backslash and returns an error when 'xxx.yyy' is passed, but succeeds when a single backslash is used.
^[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]*)*$
DNS Zone regex is used in following models:
groupnet_subnet_create_params
groupnet_subnet_extended
groupnet_subnet
subnets_subnet_pool_create_params
subnets_subnet_pool
subnets_subnet_pools_pool
Are these regexes incorrectly using '\' or am I missing something?