Here's my code.
Code: Select all
proc bash:random {nick uhost handle chan args} {
set key [http::geturl $::rand_url]
set line [http::data $key]
set quote [regexp -inline -all {<p class="qt">[^\f\t\v]{1,}</p>} $line]
foreach qt [split $quote "\n"] {
if {[string first $quote "<b>#"] > 0} {
return
}
set show_quote [uncode $qt]
if {$show_quote != ""} {
putserv "PRIVMSG $chan :$show_quote"
}
}
putserv "PRIVMSG $chan :\002End of quote\002"
}
Code: Select all
<p class="something"><b>#1</b></p><p class="qt">here is a line<br />
and another one</p>
<p class="something"><b>#2</b></p><p class="qt">oh, a line<br />
and another one</p>
and I can't because the regexp returns:on the chan wrote:<egg> here is a line
<egg> and another one
<egg> --- Next ---
<egg> oh, a line
<egg> and another one
<egg> End of quote
I can't succeed in finding the good way to have the regexp splitting my source in an array, or other format allowing me to have each part separated.real wrote:<egg> here is a line
<egg> and another one
<egg> #2 oh, a line
<egg>and another one
<egg> End of quote
I know I can split on '<p class="something">' but I'm sure I can find a beautifull way with regexp...