in reply to simple regex help
i'd like to not use an html tree module to handle this -- and keep it all in regex. is this possible?In a word yes. But, imo, very tricky.
You didn't say what exactly you're looking for. Perhaps some examples, including those nested <li>s?
It's very easy to "get at" all the html elements. I'd wager a solution could be found using something like the following.
output:#!/usr/bin/perl use strict; use warnings; use HTML::TokeParser::Simple; my $html = do{local $/; <DATA>}; my $p = HTML::TokeParser::Simple->new(\$html) or die "can't parse string: $!\n"; while (my $t = $p->get_token){ printf "*%s*\n", $t->as_is; } __DATA__ <li><span class="title">Title</span> MATCH HERE </li>
*<li>* *<span class="title">* *Title* *</span>* * MATCH HERE * *</li>* * *
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: simple regex help
by nmerriweather (Friar) on Apr 18, 2007 at 17:08 UTC | |
by wfsp (Abbot) on Apr 18, 2007 at 17:19 UTC | |
by ikegami (Patriarch) on Apr 18, 2007 at 17:52 UTC | |
by Fletch (Bishop) on Apr 18, 2007 at 17:59 UTC | |
by ikegami (Patriarch) on Apr 18, 2007 at 19:48 UTC |