re_module

PHOTO EMBED

Thu Mar 04 2021 08:33:23 GMT+0000 (Coordinated Universal Time)

Saved by @Bartok #python

import re

email = 'bartoszjakubiak23@gmail.com'
expresion = '[a-z\.]+'


domain = re.findall(expresion ,email)

print(domain)



price = 'Price : $189.45454'
expresion = 'Price : \$([0-9]*\.[0-9]*)' # \ escape character , * any number of numbers


matches = re.search(expresion ,price)

print(matches.group(0)) # entire match
print(matches.group(1)) # first thing in brackets
"""
. - matches one character
* many characters
[abc] - range of characters
[abc]+ matches one or more of this set
[A-z]+ - upercase
[A-z\.]@[A-z\.]+  - email
[A-z\.]@[A-z]+\.(com|me) - email


"""

content_copyCOPY