-2

For extracting everything between two different regular expression structures, I use this:

%%Different Regular Expressions%%(.*)%%Different Regular Expressions%%

The problem with using (.*) is that it doesn't contain line breaks (\n*). Is there any way to modify this structure or using a more efficient structure instead of this for extracting everything between two defined regular expressions?

Eghbal
  • 3,604
  • 12
  • 49
  • 108

1 Answers1

1

Use s flag, it makes dot(.) matches newline

Regex Demo

Note: As @bobblebubble mentioned in comments in python you can use re.DOTALL for s flag

Alireza
  • 2,011
  • 1
  • 5
  • 18