Thanks for the help. It definitely is getting me on the right track, but I'm not quite there.
Let's look at a Garfield search. Your second code does show both exact matches and the popular. I don't need popular, but need exact and partial (not approximate either). Partial would use title_substring in the regex. I made that change and it shows only the first 3 matches. That is probably due to not using binary variables.
Below is the current sockread event. The second section (the ELSE) is where the search part is handled. Any chance you can work your code into there so it will list all results for exact and partial titles?
on *:SOCKREAD:imdb.*:{
if ($sockerr) {
!echo -ecs info * Could not read from socket ' $+ $sockname $+ ' ( $+ $gettok($sock($sockname).wsmsg,2-,32) $+ )
hfree -w $sockname
return
}
var %data
if (*.fetchquotes.* iswm $sockname) {
sockread -n &data
while ($sockbr) {
%data = $bvar(&data,1-930).text
var %id = $hget($sockname,id)
if (<a name="qt*"></a> iswm %data) {
var %quoteid = $gettok(%data,2,34)
hadd -m $sockname quoteid %quoteid
if (!$isdir(imdbquotes)) mkdir imdbquotes
if (!$isdir(%id)) mkdir imdbquotes\ $+ %id
var %file = imdbquotes\ $+ %id $+ \ $+ %quoteid $+ .dat
if ($isfile(%file)) write -c %file
}
elseif (%data == <hr width="30%">) || (<div align="center"> * iswm %data) || (*Related Links* iswm %data) {
if $hget($sockname,quoteid) {
hinc -m $sockname count
hdel -w $sockname quoteid
}
}
elseif ($hget($sockname,quoteid)) {
var %quoteid = $ifmatch, %file = imdbquotes\ $+ %id $+ \ $+ %quoteid $+ .dat
if (%data != $null) {
var %string = $nohtml(%data)
if (%string != $null) {
bset -t &info 1 %string
bset &info $calc($bvar(&info,0) + 1) $iif($right(%data,1) == :,32,13 10)
bwrite %file -1 -1 &info
bunset &data &info
}
}
}
sockread -n &data
}
}
else {
sockread %data
while ($sockbr) {
var %regexp = /<a href="\x2ftitle\x2ftt(\d+)\x2f[^"]*"(?: onclick="set_args\x28'tt\1'\x2c1,1\x29")?>([^<]+)</a>/i
if ($regex(imdb,%data,%regexp)) {
hadd -m $sockname $calc($hget($sockname,0).item - 1) $nohtml($regml(imdb,1) $regml(imdb,2))
}
elseif (!$dialog(imdbquotes) && %data == <h2>Other Results</h2>) {
hadd -m $sockname $calc($hget($sockname,0).item - 1) -
}
sockread %data
}
}
}
Like I said, only titles (exact and partial) are needed, not names or characters. Approximate matches aren't required either. And both the name and tt number are needed.
Thanks again for helping.
**NOTE: The part about other results in there that adds a - is probably related to separating exact and partial matches from one another. It doesn't have to remain, but if it can still throw in a separator between the two, that won't hurt.