Skip to content

Conversation

@mmmoore3
Copy link
Contributor

No description provided.

@mmmoore3 mmmoore3 linked an issue Oct 23, 2022 that may be closed by this pull request
@mmmoore3 mmmoore3 removed a link to an issue Oct 23, 2022
@@ -22,7 +22,23 @@ def test_find_us_ssn(self):
def test_find_email(self):
results_list = find_email('My email address is jim.jones@jones.com')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ^ in your regex will only match at the beginning of the string. You need to remove the ^ in order to match the email in this string.

 re.findall(r'^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+', text)

@@ -22,7 +22,23 @@ def test_find_us_ssn(self):
def test_find_email(self):
results_list = find_email('My email address is jim.jones@jones.com')
self.assertEqual(results_list, [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After you correct the regex, this should be

self.assertEqual(results_list[0], 'jim.jones@jones.com')


#test an email given at the end of string
results_list = find_email("My email address is jim.jones@jones.com")
self.assertEqual(results_list[1],'jim.jones@jones.com')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

results_list is zero based so this should be

self.assertEqual(results_list[0],'jim.jones@jones.com')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants