I need some help with regex. i want to get the string which has a delimiter in it between two specific words.
e.g. i need a regex which matches:
Statements1 start Statements2 ; Statements3 end fun;
There can be multiple occurences of ' ;
' between 'start' and 'end'.
Statements are multiple words where (.*) can be used in the regex for a word.
But the regex should not match if there is no ' ;
' between the 'start' and 'end'.
Also, the 'end' should be the first 'end' encountered after 'start'
So, the regex should not match
Statements1 start Statements2 end Statements3 ; end fun
i want the matches as
- statements before 'start'
- keyword
- statements after 'start'
So, in this case it would be a group(for the 1st string since 2nd should not match) as:
- Statements1
- start
- Statements2 ; Statements3 end fun;
Thanks.