git.99rst.org
/
stevenblack-hosts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
297c699
)
Tighten regex rule to discard IP address as hostname
author
Indrajit Raychaudhuri
<redacted>
Tue, 20 Jun 2017 01:23:00 +0000
(20:23 -0500)
committer
Indrajit Raychaudhuri
<redacted>
Tue, 20 Jun 2017 07:06:31 +0000
(
02:06
-0500)
updateHostsFile.py
patch
|
blob
|
history
diff --git
a/updateHostsFile.py
b/updateHostsFile.py
index 4de7f3eb08d4b4ea0569f11aa6e7e46df1f9bd5a..59c9b6d617d64c55e557cbd30fc510f8f4661c29 100644
(file)
--- a/
updateHostsFile.py
+++ b/
updateHostsFile.py
@@
-501,7
+501,8
@@
def normalize_rule(rule):
The rule string with spelling and spacing reformatted.
"""
- result = re.search(r'^[ \t]*(\d+\.\d+\.\d+\.\d+)\s+([\w\.-]+)(.*)', rule)
+ result = re.search(r'^\s*(\d{1,3}\.){3}\d{1,3}\s+([\w\.-]+[a-zA-Z])(.*)',
+ rule)
if result:
hostname, suffix = result.group(2, 3)
git clone https://git.99rst.org/PROJECT