Greetings,

We are currently moving from Omnimark to PERL so I guess it's time to learn
some PERL. Giving the following scenario, I am wondering if PERL can cope
with the following scenario and, if so, what would the code look like:

Input Text:
<p>Text of article...
<p>And it says in Documents 1,2,3 and 4 where to go</p>
<p>End of article...

Desired Output:
<p>Text of article...
<p>And it says in Documents <A HREF="Doc1">1</A>,<A HREF="Doc2">2</A>,<A
HREF="Doc3>3</A> and <A HREF="Doc4>4</A> where to go</p>
<p>End of article...

Basically, I need it to find a pattern anchored by word "Documents" followed
by an undetermined number of #'s, some separated by commas and/or the word
'and'

We were able to do this in Omnimark by capturing the whole string anchored
by word "Documents" followed by an undetermined number of #'s, some
separated by commas and/or the word 'and', assigning it to a variable the
'scanning' it and matching the numbers and putting links around them. For
reference, following is the Omnimark code that easily accomplishes this:

Omnimark Code:
find ('Documents' WS*) = pCite (digit+ ('.' digit+)? ((',' WS*) OR (WS*
('and' OR 'through') WS*))*)+ = pSeries
        output pCite
        repeat scan pSeries
                match (digit+ ('.' digit+)?) = pValidLink
                        output '<A HREF="Doc' || pValidLink || '">' ||
pValidLink || '</A>'
                match any = pLeftOver
                        output pLeftOver
        again


Is this possible in PERL? Are there any better languages for predominantly
text transformation?

Thanks for any help, input.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to