I have multiple text file and need to wrap each paragraph in p tags using regex.
i.e. before:
Paragraph 1
Paragraph 2
Paragraph 3
Aft
Try this
(\w+\s+\d+)
Then replace with
<p>$1</p>
See demo
You can use this regex:
(.+?)(\n|$)+
and replace it with:
<p>$1</p>\n\n
The problem with your regex is, that it is matching empty lines as well, because you're saying: "Match any character zero or more times, followed by a new line".
You also have to take in count the last paragraph, that might not end with a line break.