in reply to Template Parsing - Finding tag pairs.

/me fails to see why you're trying to re-invent the wheel.

CF looks a lot like html tags to me. Of course, HTML::Parser is great for parsing html documents, even if it's pseudo-html. Of one of the many modules using HTML::Parser...
If for some reason that's not useable, you could try Text::Balanced, a module that can extract something delimited by balanced html-alike tags, and a lot of other parsing.
And there are many, many other prefab parsing modules. What's your motivation for not using any of those?

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: Template Parsing - Finding tag pairs.
by IlyaM (Parson) on Dec 25, 2001 at 23:59 UTC
    I suppose that HTML::Parser is unusable for CF. The trick is that parser must notice only CF tags. Text document with CF tags can easily look as invalid html document for HTML::Parser in many cases.

    --
    Ilya Martynov (http://martynov.org/)

      I'm not familiar with CFML. There might be some tags that would make invalid syntax, but if there are not, $htmlparser->report_tags(qw/cfif cfelseif cfelse cfoutput cfinclude cfetcetera/) might provide for easy parsing using event subs.

      2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

        Simple example. How it will handle CF tags inside HTML tags? Or CF tags in text non-HTML documents (which can contains anything)?

        --
        Ilya Martynov (http://martynov.org/)