You may use this regex with a lookahead and \G
:
(?:\bSTART\b|(?!^)\G)\h+(?!END\b).*?\b(\w{3,})(?=.*?\bEND\b)
RegEx Details:
(?:\bSTART\b|(?!^)\G)
: Match wordSTART
or starting from end of previous match match 0 or more words separated by 1+ whitespace.\G
: asserts position at the end of the previous match or the start of the string for the first match\h+(?!END\b).*?(\w{4,})
: Match 1+ whitespace followed 0 or more characters followed by a word of 4+ length which is captured in group #1(?=.*?\bEND\b)
: Lookahead to assert presence of wordEND
ahead
CLICK HERE to find out more related problems solutions.