0

I have a string that looks like this:

s = {u\'main\': u\'SNEAK THIEVES GET $3,200.; Members of "The Girl From Maxim\'s" Company Lose $1,200.\'}

I'm trying to match only the section, which looks like this:

SNEAK THIEVES GET $3,200.; Members of "The Girl From Maxim\'s" Company Lose $1,200. in python.

Using the following regex:

re.search(r"(?<=\:\su\').*?(?=\')", s)

I've managed to capture a part of the string:

SNEAK THIEVES GET $3,200.; Members of "The Girl From Maxim

As you can tell, this is incomplete because the \' sequence occurs more than once in my string.

Is it somehow possible for me to capture all text between the first instance of a particular sequence (this part I've managed) and the the final instance of a sequence which occurs multiple times?

TLDR, simplified

given string = AAA BBB DD DD DD, is it possible to capture everything between sequence AAA and the final occurrence of sequence DD?

scrollex
  • 2,575
  • 7
  • 24
  • 38

0 Answers0