-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,392
  • 11
  • 40
  • 100

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
  • 755
  • 1
  • 1
  • 9