How do you match the first occurance of start, starting from the end of the string? I have tried it with a negative lookahead but instead I get start\nfoo\nmoo\nstart\nfoo\ndoo as match
import re
pattern='(start[\s\S]*$)(?=$)'
string='start\nfoo\nmoo\nstart\nfoo\ndoo'
re.search(pattern, string)
expected match: start\nfoo\ndoo