Regex pattern to match using starts with and ends with a word(start word multiple occurrence)

16 views Asked by At

So I have a string say "Explain STARThow you STARTencountered the problem you’reSTART trying to solveEND, and anySTART difficulties that STARThave prevented you fromEND solving it yourself."

I have this pattern: @"START.*?END";

But when I evaluate and match this I am getting: "STARThow you STARTencountered the problem you’reSTART trying to solveEND" and "START difficulties that STARThave prevented you fromEND"

What I need is to get the occurrence where the START word is closest to the END word: "START trying to solveEND" and "STARThave prevented you fromEND"

0

There are 0 answers