jacques has asked for the wisdom of the Perl Monks concerning the following question:

Recently I needed to find all the words that are in a mason tag such as:
<% "tab-fade-right"|i %>
The "i" flag has to be there. So in this example, I would want "tab-fade-right". The problem with using a regex to get the job done is the same problem faced by using a regex to parse HTML. I guess I would want to use something like HTML::Parser but for Mason tags. Any suggestions?

Would it be better to have Mason process the page and then somehow grab what is being escaped by the "i" flag?

Replies are listed 'Best First'.
Re: Parsing Mason tags like HTML tags?
by PodMaster (Abbot) on Oct 06, 2005 at 03:38 UTC
      Thanks for the reply, but I found that since you can't have nested mason tags such as:
      <% <% $example %> %>
      Then a properly done regex could handle them.
Re: Parsing Mason tags like HTML tags?
by johnnywang (Priest) on Oct 06, 2005 at 19:51 UTC
    If regex is not good enough for you (sounds like it should be), maybe you can replace the mason tags (in memory) by an innocent html tag, and run through the HTML::Parser? just a thought.