Reputation: 667
I have a large html text file that has some inconsistency in ending a paragraph with full-stop.
Below is an example.
<p>Text ending with a full-stop.</p>
<p>Text ending without a full-stop</p>
I want to search for all paragraph that doesn't end with full stop and add a full-stop to it.
Note: am using Notepad++ for the regex search.
How do i do that?
I came up with this [^.](?:</p>)
which matches paragraph without fullstop together with the </p>
tag.
If only i could use the capture group to do the regex search instead and then replace it with .</p>
Anybody know how i can resolve this?
Upvotes: 2
Views: 367
Reputation: 9750
You can use ([^.])(?=<\/p>)
that translates to:
Match any character that isn't a dot and is followed by
</p>
You can then use the backreference of the first group to add the missing dot by replacing with \1.
as seen in this demo I created.
Upvotes: 1