Mar-24-2023, 04:15 PM
You have spaces around the word "paragraph", and nothing happens to them. I'm going to replace them with dots here just for visibility. But you might start with the string
Printed, that would be:
A.paragraph.B
. After substitution that becomes A.\n\n.B
. Printed, that would be:
Output:A.
.B
You could capture optional whitespace around the keywords as part of your regex and that might improve things. Or you could remove any whitespace following a newline if you never want any indents (intentional or not).