ENH: <HOST> must end with alphanumeric \w (not a dot or a dash etc)

Otherwise <HOST> regexp might swallow period in the sentence right after the address.
I have decided to enforce alphanumeric instead of switching to non-greedy +? ... because
I think it is closer to what we actually want here
This commit is contained in:
Yaroslav Halchenko
2013-07-16 14:39:42 -04:00
parent 8add63c733
commit 0a02cfe9e8
2 changed files with 5 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ class Regex:
self._matchCache = None
# Perform shortcuts expansions.
# Replace "<HOST>" with default regular expression for host.
regex = regex.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)")
regex = regex.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>[\w\-.^_]*\w)")
if regex.lstrip() == '':
raise RegexException("Cannot add empty regex")
try: