I want to capture all the strings from the beginning to the string immediately before the third occurrence which is “two”. I did the below pattern but it matches all the string.
Pattern: (.*two){3}
String: One Two Three Four Two Five Six Two Seven Two Eight Nine Ten Two Eleven
Match: One Two Three Four Two Five Six Two Seven