-3
Pattern.compile ("\\n\\n(.*)\\z", Pattern.DOTALL);
Keith Thompson
  • 230,326
  • 38
  • 368
  • 578
Rajani
  • 5
  • 5
  • Matches `\n\n`, then everything (`.` with `DOTALL`) to the end of the string (`\z`) – ctwheels Feb 20 '18 at 21:16
  • @ctwheels The code is in Java. Rajani, it is really a very simple regex, just matches all from the end of the first paragraph till the end of input. See [the regex demo](https://regex101.com/r/mEBRSo/1). – Wiktor Stribiżew Feb 20 '18 at 21:42
  • [Java's documentation](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html) covers all this information: – ctwheels Feb 20 '18 at 21:48

1 Answers1

0

The dot character matches every character except the line terminator, with the DOTALL option you ask it to match also for line terminators.

The regex matches two newlines, then you allow to match the any character (or newline) 0 or more times (this is the meaning of the asterisk).

The \z matches at the very end of the string.

Nisba
  • 2,502
  • 1
  • 20
  • 39