Matching the 3rd occurrence in regex

Viewed 19

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
0 Answers
Related