i have this
begin [someText] end
- [someText] is dynamic
- I want to match only [someText] with a regex .
- I only want what's between these two words ( begin , end )
i have this
begin [someText] end
Keeping all whitespace
re.match(r'begin(.*)end', text, re.DOTALL).group(1)
Ignoring whitespace before "begin" and "end":
re.match(r'begin\s*(.*)\s*end', text, re.DOTALL).group(1)
This assumes text
always contains a match and begins with "begin".