I want to obtain all the letter-only "chains" of at least 1 word starting with uppercase letters and followed by lowercase letters, connected with either space (" ") or "-" (a "chain" cannot be connected with "-" and with " ")
For example, for the following text:
For the First Stage, you should press Start and you should follow Step-One and Step-Three. For the Final Stage, you must follow the sequence of One-Two-Five-Seven Steps
My output should be
["For", "First Stage", "Start", "Step-One", "Step-Three", "Final Stage", "One-Two-Five-Seven", "Steps"]
Until now, I have tried writing 2 different regexes to solve my problem; first string should return "chains" connected with "-" and the second should return "chains" connected with " ":
import re
list(set(re.findall('([A-Z][a-z]+-)*[A-Z][a-z]+', mystring) + re.findall('([A-Z][a-z]+ )*[A-Z][a-z]+', mystring)))
However, I guess it is something wrong with them, as neither of them is working properly.