diff --git a/setup.py b/setup.py index 626c378..3776961 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup(name='talon', zip_safe=True, install_requires=[ "lxml==2.3.3", - "regex==0.1.20110315", # handling of .* changes from version 0 to 1 + "regex>=1", "html2text", "nose==1.2.1", "mock", diff --git a/talon/signature/learning/helpers.py b/talon/signature/learning/helpers.py index 38259c3..51a9227 100644 --- a/talon/signature/learning/helpers.py +++ b/talon/signature/learning/helpers.py @@ -17,7 +17,7 @@ from talon.signature.constants import SIGNATURE_MAX_LINES rc = re.compile RE_EMAIL = rc('@') -RE_RELAX_PHONE = rc('.*(\(? ?[\d]{2,3} ?\)?.{,3}){2,}') +RE_RELAX_PHONE = rc('(\(? ?[\d]{2,3} ?\)?.{,3}?){2,}') RE_URL = rc(r'''https?://|www\.[\S]+\.[\S]''') # Taken from: diff --git a/tests/signature/learning/helpers_test.py b/tests/signature/learning/helpers_test.py index 7a57f6c..704db4e 100644 --- a/tests/signature/learning/helpers_test.py +++ b/tests/signature/learning/helpers_test.py @@ -43,7 +43,7 @@ VALID_PHONE_NUMBERS = [e.strip() for e in VALID.splitlines() if e.strip()] def test_match_phone_numbers(): for phone in VALID_PHONE_NUMBERS: - ok_(RE_RELAX_PHONE.match(phone), "{} should be matched".format(phone)) + ok_(RE_RELAX_PHONE.search(phone), "{} should be matched".format(phone)) def test_match_names():