Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = re.compile(r"I am (d{1,2}) .*", re.IGNORECASE)
- text = "i am 32 years old"
- if re.match(pattern, text):
- print(
- re.sub(pattern, r"Your are 1 years old.", text, count=1)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement