Regex to Select HTML Tag (& Contained Text) ONLY When It’s Multiline

I have a very large document that contains HTML tags that are split onto multiple lines. All the formatters I’ve tried do not format them onto single lines.

The regex I have is:

(.|\n)*?<\/p>

However this is selecting both single line and multiline cases.

Here are some test cases (I’ve noted expected outcome, currently all four are being selected):

// Should NOT match, as it's all on one line:

start - Uses an area level ("Name field" from levels.txt) to define where the player starts in the Act

// SHOULD match, as it's multiline:

maxnpcitemlevel - Controls the maximum item level for items sold by the NPC in the Act

// Should NOT match, as it's all on one line:

This file controls global Act functionalities including item levels, monster behaviors, and waypoints

// SHOULD match, as it's multiline:

wanderingMonsterRegionTotal - The maximum number of wandering monsters allowed at once

I’ve created a regex101: regex101.com/r/XLflH4/2

Read more here: Source link