"Mark Wagner" schreef:
> 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?
Look for a proper module first, like Parse::RecDescent
http://search.cpan.org/~tbone/Parse-RecDescent-FAQ/FAQ.pm
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/