I am a newbie in python. I am coding in python 2.7. I have two strings that look like:
a = ": Handle reset full zone for zone management send to individual zone case. Contact [email protected]"
b = " 123andle reset [full] zone for zone >= management: send to individual zone case. Robotics: 431."
How do I extract the whole string except for the first colon and first space(: ) in a and the first space in b? So everything else other than those two things should be printed. Here is how it should look like:
Handle reset full zone for zone management send to individual zone case. Contact [email protected]
123andle reset [full] zone for zone >= management: send to individual zone case. Robotics: 431.
I am allowed to use only one algorithm to parse both strings a and b. So one regex pattern algorithm shall be used to parse both and give the correct result. Note that the sentence can look like anything and contain any type of alphanumeric or non alphanumeric characters and so all of it should be printed.
a = ": Handle reset full zone for zone management send to individual zone case. Contact [email protected]"
b = " 123andle reset [full] zone for zone >= management: send to individual zone case. Robotics: 431."
str = []
str.append(a)
str.append(b)
title_regex = "\w+"
for str_in in str:
title = re.findall(title_regex, str_in)
print(title)
But this implementation is not right as I get a list of words where the whitespace is not considered and also the [] and some non alphanumeric characters a re also not considered.