I want to match all words except words that end in a hyphen at the end of a line. I want hyphenated words not at the end of a line to be matched.
>>> re.findall("[A-Za-z0-9']+(?!-$)","In-middle hyphens (yes) but shouldn't match hyphens at end-")
['In', 'middle', 'hyphens', 'yes', 'but', "shouldn't", 'match', 'hyphens', 'at', 'en']
The undesired behavior is the 'en' (last match). I want 'at' to be the last match in this case. I assume that this is a syllable split and I will count the word when it finishes on the next line.
Any ideas of how to make my regex "all-or-nothing" so that it won't match any letters from a word which ends in a hyphen at the end of a line?