On 10/23/07, Matthew Whipple <[EMAIL PROTECTED]> wrote:
> Mark Wagner wrote:
> > I'm working on a program to process Wikipedia pages.  Wikipedia pages
> > can contain templates of the form:
> >
> > {{template name
> > |key = value
> > |key2 = value2
> > |...
> > }}
> >
> > Any value may in turn be a template, with essentially no limit to the
> > level of nesting.  Given a "key = value" pair, how would I go about
> > retrieving the entire template from the page?
> >
> > In C, I'd use strstr() to find the "key = value" pair, walk my way
> > back up the string until I found an unmatched "{{" as the beginning of
> > the template, and walk down the string until I found an unmatched "}}"
> > as the end.  How would I do this in Perl?
> >
> >
> Are you looking for the way to implement the outlined algorithm in Perl,
> or suggestions on other ways to process the data?
> By "processing the data" as far as the question goes, you're looking to
> create a hash for each template?

Basically, I can find the middle of a template.  From there, I want to
identify the entire template.  I don't much care how.

-- 
Mark

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to