I have tried to find the answer looking in HTML::Parser or XML::Parser. But in those modules the core parser is made in C.

The "Cheap HTML parser by Jim Davis" doesn't care about the problem I try to solve:

If you have a file in an array, is easy to find the tag pattern:
 clear text<tag...> clear text

But it's not so easy to find:
clear text <tag var1=".." var2="..>.." > clear text

One way is test if you have odd numbers of ("), if true, you have to look for the next '>' to get the complete tag, but I don't know how to it right and fast.

So, the problem is how can I count the number of time a caracter appears in a string.

Thanks!
--Edu

In reply to parsing HTML by eod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.