I have a string that is randomly generated:
polymer_str = \"diol diNCO diamine diNCO diamine diNCO diamine diNCO diol diNCO diamine\"
I\'d
Using re:
m = re.search(r"(\bdiNCO diamine\b\s?)+", polymer_str) len(m.group(0)) / len("bdiNCO diamine")