Reputation: 893
Using this (?sm)^.*?\.$
I retrieve every paragraph from my text.
When there are "spaces" at the end of the text the last paragraph isn't matched. What do I have to use to fix that?
Example text:
Copyright laws are changing all over the world. Be sure to check the
copyright laws for your country before downloading or redistributing
this or any other Project Gutenberg eBook.
This header should be the first thing seen when viewing this Project
Gutenberg file. Please do not remove it.
Please read the "legal small print", and other information about the
eBook and Project Gutenberg at the bottom of this file.
Upvotes: 2
Views: 1635
Reputation: 31035
If you want to fix your regex, then you can add \s*
at the end of the pattern:
(?sm)^.*?\.\s*$
However, you can use a split method with a regex like this:
^\t*$
Upvotes: 2