import re

str = "yes I said yes I will Yes."

res = re.sub("[yY]es","no", str)

print(res)

str = "Course location is London or Paris!"

res = re.search(r"location.*(London|Paris|Zurich|Strasbourg)",str)

if res:

 print(res.group())

line = "James;Miller;teacher;Perl"

line=re.split(";",line)

print(line)

t="A fat cat doesn't eat oat but a rat eats bats."

mo = re.findall("[force]at", t)

txt1 = re.findall('\S', t)

txt2 = re.findall('\W', t)

print(mo)

print(txt1)

print(txt2)