Click here to get back home

Extracting strings delimited by other strings

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Extracting strings delimited by other strings Scott Bass 05-07-2005
Posted by Scott Bass on May 7, 2005, 11:54 am
Please log in for more thread options


Hi,

I need to write some code that will allowed embedded, specially formatted
comments to document test cases within a program (SAS code). The code will
process the programs, pulling out the test case information. AFAIK this is
similar to how Javadoc works, embedding documentation alongside code.

The syntax will look like:

/*
<testcase>
TESTID: TEST1
OBJECTIVE: The objective of the test
PROCEDURE: The procedure that the test uses
Continuation line from the above
RESULTS: The expected results of the test
Continuation line
Another "continuation" line
</testcase>
*/

The syntax can also be embedded in titles statements:

/* <testcase> */
title3 "TESTID: TEST1";
title4 "OBJECTIVE: The objective of the test";
title5 "PROCEDURE: The procedure that the test uses";
title6 " Continuation line from the above";
title6 "RESULTS: The expected results of the test";
title7 " Continuation line";
title8 ' Another "continuation" line';
/* </testcase> */

After processing the program, the desired output is a tab-delimited string
containing filename, testid, objective, procedure, and results. For those
lines that were continued, I would like an embedded CR/LF. Leading spaces
should be
removed, as well as any title statements, "outer" quotation marks
(preserving inner quotation marks), and trailing semi-colons.

Are there any modules that I could use as a starting point for this? If you
have any code does something similar, could you either post it or email it
to me? It will be easier to modify an existing example than to start from
scratch.

Kind Regards,
Scott






Similar ThreadsPosted
strings and numbers July 30, 2005, 2:28 am
strings and numbers July 30, 2005, 2:27 am
Will XML::Simple work with keys, strings, integers, and dates? March 21, 2005, 10:43 am
CPAN not extracting documentation August 8, 2005, 6:28 pm
Extracting value from data within an element. November 30, 2005, 5:26 am
newbie extracting same text from earch results October 7, 2005, 7:46 pm
PDF::API2 - Extracting text and position from PDF file April 17, 2008, 9:20 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap