"""Run the reading examples in order from this folder."""

import re

print(re.search(r'cat', 'the cat sat on the mat'))
print(re.search(r'dog', 'the cat sat on the mat'))

if re.search(r'cat', 'the cat sat'):
    print('found it')

print(re.search(r'\d', 'order #42 shipped'))

print(re.search(r'\d+', 'order #42 shipped'))

print(re.findall(r'[aeiou]', 'regular'))
print(re.findall(r'colou?r', 'color and colour'))

text = 'call 909-621-8000 or 213-555-0199 today'
print(re.findall(r'\d{3}-\d{3}-\d{4}', text))

print(re.findall(r'(\d{3})-\d{3}-\d{4}', text))

print(re.findall(r'(\d{3})-(\d{3}-\d{4})', text))

print(re.findall(r'\w+@\w+\.\w+', 'reach me at ada@example.com or grace@navy.mil'))

print(bool(re.search(r'cat', 'the cat sat')))
print(bool(re.fullmatch(r'cat', 'the cat sat')))
print(bool(re.fullmatch(r'cat', 'cat')))

phone_pattern = r'\d{3}-\d{3}-\d{4}'
print(bool(re.fullmatch(phone_pattern, '909-621-8000')))
print(bool(re.search(phone_pattern, '909-621-80000')))
print(bool(re.fullmatch(phone_pattern, '909-621-80000')))

print(re.sub(r'\d{3}-\d{3}-\d{4}', '[redacted]', text))
