in reply to Conditional regex

My first reaction: don't attempt to parse HTML with regex's, from scratch.

If you must for some reason, I did see code for complete grammar somewhere...ah, XML::Easy::Syntax.

—John

Replies are listed 'Best First'.
Re^2: Conditional regex
by ikegami (Patriarch) on May 08, 2009 at 20:59 UTC
    While there exists an XML serialization of HTML (XHTML), the OP is not using it (as indicated by uppercase "IMG").
      But if he already identified a complete opening tag for the IMG, the code in there might help him break it up into attributes. Or, if he has trouble reliably finding a complete opening tag, that code might help him do that. It's not a complete parser, but a list of canned regex's doing what he asked for. And they can be further modified.

        It's not a complete parser, but a list of canned regex's doing what he asked for.

        It's a list of canned regex's doing something similar to what he asked for. XML and HTML syntaxes are different.

        The OP could derive the HTML equivalents from them, but it's moot since he expressed a desire to not use CPAN.