Input:
get \tag-start Snooby ~p snoopy \tag-end please
Output: Snooby
(after the tag and before ~p; non-greedy capture because some sentences contain several tags)
echo 'get \tag-start Snooby ~p snoopy \tag-end please' | sed 's/.*tag-start \(.*?\) ~p.*/\1/'
I don't know where goes wrong but this regex doesn't work to extract info in this case.