Using regex to find any last occurrence of a word between two delimiters -
suppose have following test string:
start_get_get_get_stop_start_get_get_stop_start_get_stop
where _ means characters, eg: startagetbbgetcccgetddddstopeeeeestart....
what want extract last occurrence of word within start , stop delimiters. result here 3 bolded below.
start__get__get__get__stop__start__get__get__stop__start__get__stop
i precise i'd using regex , far possible in single pass.
any suggestions welcome
thanks'
get(?=(?:(?!get|start|stop).)*stop)
i'm assuming start
, stop
delimiters balanced , can't nested.
Comments
Post a Comment