<commit_before>import re


pattern = re.compile('^dog$')
print pattern.match('dog')
print pattern.match('xdog')
<commit_msg>Very basic email address finder<commit_after>""" Now you have two problems

https://docs.python.org/2/library/re.html

https://docs.python.org/2/howto/regex.html
"""

import re


# Exact string match
pattern = re.compile('^dog$')
print pattern.match('dog')
print pattern.match('xdog')


# Basic .com email address
print ''
pattern = re.compile('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.com$')
print pattern.match('<EMAIL>')
print pattern.match('@y.com')
print pattern.match('x@y.')
print pattern.match('&<EMAIL>*---')


# Find email address w/in larger string
print ''
pattern = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.com')
print pattern.search('<EMAIL>')
print pattern.search('@y.com')
print pattern.search('x@y.')
print pattern.search('<EMAIL>*---')
print pattern.match('&<EMAIL>*---')  # not exact match

print ''
print 'parsing it out:'
search_results = pattern.search('<EMAIL>*---')
print dir(search_results)
print search_results.group(0)
{'fraction_non_alphanumeric': 0.21334586466165414, 'fraction_numerical': 0.010338345864661654, 'mean_word_length': 4.916666666666667, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3759799', 'n_tokens_mistral': 395, 'n_tokens_neox': 384, 'n_words': 79}