Adding a full stop to a heading using a regular expression
Posted: 27 Mar 2024, 06:42
textfile before:
textfile after:
I have a text file that consists of normal text and headings between the individual text sections. The headings between the
text sections are characterised by the fact that they do not have a full stop, they are separated by at least one blank line before and after the next text section.
The text headings can also extend over several lines. A full stop should simply be added to these headings as a punctuation mark.
How can this be achieved with a regular expression?
Code: Select all
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
This is a my first heading ; adding a full stop to headline here
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Another heading that extends over more than one line Another heading that
extends over more than one line ; adding a full stop to headline here
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Code: Select all
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
This is a my first heading. ; heading now with fullstop
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Another heading that extends over more than one line Another heading that
extends over more than one line. ; heading now with full stop
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla. Bla bla bla bla.
text sections are characterised by the fact that they do not have a full stop, they are separated by at least one blank line before and after the next text section.
The text headings can also extend over several lines. A full stop should simply be added to these headings as a punctuation mark.
How can this be achieved with a regular expression?