[PATCH 1/2 rhel7-branch] Text network spoke (2 patches squashed) (#909299)
David Shea
dshea at redhat.com
Mon Aug 26 19:16:53 UTC 2013
On 08/22/2013 09:20 AM, Radek Vykydal wrote:
> +
> +RE_IPV4="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}"
>
This expression will match three octets, a final dot, and then anything.
So '0.0.0.' matches, as does '0.0.0.500.not-an-ip'. The fourth octet
needs to be added to the end, so:
RE_IPV4="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
This will still match an IP address followed by anything until an ending
anchor is added. But, since it's being used to construct another regex
in this expression:
re.compile(RE_IPV4+"|dhcp$"),
I recommend leaving off the beginning anchor, making a note in the
variable name or the comment that this expression is a fragment that
will match the beginning of a string rather than an entire string, and
construct the whole thing in the parameter to Entry as re.compile("^" +
RE_IPV4 + "|dhcp$")
More information about the anaconda-patches
mailing list