I'm trying to use regex to match every character between a string and a \r character :
text = 'Some text\rText to find !\r other text\r'
I want to match 'Text to find !'. I already tried :
re.search(r'Some text\r(.*)\r', text).group(1)
But it gives me : 'Text to find !\r other text'
It's surprising because it works perfectly when replacing \r by \n :
re.search(r'Some text\n(.*)\n', 'Some text\nText to find !\n other text\n').group(1)
returns Text to find !
Do you know why it behaves differently when we use \r and \n ?