This regex should match what you want:
(start((?!start).)*?end)
Use re.findall
method and single-line modifier re.S
to get all the occurences in a multi-line string:
re.findall('(start((?!start).)*?end)', text, re.S)
See a test here.
More Related Contents:
- How to make a this specific Pattern [closed]
- Regex in Python and save in csv [closed]
- Convert perl regex to python [closed]
- Is there a simple way to remove multiple spaces in a string?
- How to correctly sort a string with a number inside? [duplicate]
- Regular expression to match a dot
- Python non-greedy regexes
- Match text between two strings with regular expression
- How to replace only part of the match with python re.sub
- Python Regex escape operator \ in substitutions & raw strings
- How to extract an IP address from an HTML string?
- Get the string within brackets in Python
- Regex for existence of some words whose order doesn’t matter
- Split string on commas but ignore commas within double-quotes?
- Python/Regex – How to extract date from filename using regular expression?
- Python regex: splitting on pattern match that is an empty string
- How to remove symbols from a string with Python? [duplicate]
- Python – Locating the position of a regex match in a string?
- How to find and replace nth occurrence of word in a sentence using python regular expression?
- Python unicode regular expression matching failing with some unicode characters -bug or mistake?
- How to split a string by commas positioned outside of parenthesis?
- Regex to match digits of specific length
- Regex: match only outside parenthesis (so that the text isn’t split within parenthesis)?
- Faster way to remove stop words in Python
- Why doesn’t Python’s `re.split()` split on zero-length matches?
- Regular expression that finds and replaces non-ascii characters with Python
- How can I find all placeholders for str.format in a python string using a regex? [duplicate]
- restrict 1 word as case sensitive and other as case insensitive in python regex | (pipe)
- In regex, what does [\w*] mean?
- Adding characters after a certain word in Python using regex