http://qs321.pair.com?node_id=556880

rsriram has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have a text file where the start and end of List will be marked with <list> and </list>. I want to code every paragraphs appearing inside this to be tagged as <item> and </item>

For example
Input format

The quick brown fox jumps over the lazy dog. The quick brown fox jumps + over the lazy dog. The quick brown fox jumps over the lazy dog. The +quick brown fox jumps over the lazy dog. The quick brown fox jumps ov +er the lazy dog. The quick brown fox jumps over the lazy dog. <list>The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</list> The quick brown fox jumps over the lazy dog. The quick brown fox jumps + over the lazy dog. The quick brown fox jumps over the lazy dog. The +quick brown fox jumps over the lazy dog. The quick brown fox jumps ov +er the lazy dog. The quick brown fox jumps over the lazy dog.

Output should be:

The quick brown fox jumps over the lazy dog. The quick brown fox jumps + over the lazy dog. The quick brown fox jumps over the lazy dog. The +quick brown fox jumps over the lazy dog. The quick brown fox jumps ov +er the lazy dog. The quick brown fox jumps over the lazy dog. <list><item>The quick brown fox jumps over the lazy dog.</item> <item>The quick brown fox jumps over the lazy dog.</item> <item>The quick brown fox jumps over the lazy dog.</item></list> The quick brown fox jumps over the lazy dog. The quick brown fox jumps + over the lazy dog. The quick brown fox jumps over the lazy dog. The +quick brown fox jumps over the lazy dog. The quick brown fox jumps ov +er the lazy dog. The quick brown fox jumps over the lazy dog.

Can anyone give a regex pattern to replace this?

Sriram

20060622 Janitored by Corion: Added code tags around data, as per Writeup Formatting Tips