anlamarama has asked for the wisdom of the Perl Monks concerning the following question:
I would like to implement a text tagging system. What is the best way to do this?
For example;
The text is:
Lorem ipsum {{tag1}} sit amet, consectetur adipiscing elit. Vestibulum bibendum mi in ipsum {{tag2}} id sagittis dolor ultrices. Maecenas vitae nunc diam, quis gravida augue. Integer...
and, I have 2 text files, tag1.txt tag2.txt
What I want to do is to fetch one line for each tag when I execute the code. The text files will be looped when it reaches the end of the file.
tag1.txt
tag1example1
tag1example2
tag2.txt
tag2example1
tag2example2
tag2example3
the text will be:
Lorem ipsum tag1example1 sit amet, consectetur adipiscing elit. Vestibulum bibendum mi in ipsum tag2example1 id sagittis dolor ultrices. Maecenas vitae nunc diam, quis gravida augue. Integer...
Lorem ipsum tag1example2 sit amet, consectetur adipiscing elit. Vestibulum bibendum mi in ipsum tag2example2 id sagittis dolor ultrices. Maecenas vitae nunc diam, quis gravida augue. Integer...
Lorem ipsum tag1example1 sit amet, consectetur adipiscing elit. Vestibulum bibendum mi in ipsum tag2example3 id sagittis dolor ultrices. Maecenas vitae nunc diam, quis gravida augue. Integer...
and so on..
I need to use regular expressions, but what is the best/efficient way to achieve this?
Thanks in advance,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text Tagging
by wfsp (Abbot) on Oct 25, 2009 at 06:21 UTC | |
by anlamarama (Acolyte) on Oct 25, 2009 at 07:02 UTC | |
|
Re: Text Tagging
by Anonymous Monk on Oct 29, 2009 at 00:22 UTC |