I would like to match a text that is surrounded by one of two allowed symbols (let's say & and #). Whichever of the two symbols is used before the text, should follow after the text; the second symbol option is not allowed (eg. &Time& and #Time# are valid but &Time# is not). I would like to try using lookbehind and lookforward for this by capturing the first symbol in a group. But when I try to do this, the lookbehind and lookahead parts are also included in the match. Is it possible to extract just the text using lookbehind and lookahead with backreference?
r"(?<=(&|#))([A-Za-z]+)(?=(\1))" matches all the string &Hawai&#Rome# instead of extracting Hawai and Rome