I'd suggest you check wether your regexp matched the epxression before trying to use the submatch variables.
In this case, as the webpage returns "No match for anagram<br><br>", it won't match that regexp (and thus no submatches either).
Try something like this:
nml375 wrote:I'd suggest you check wether your regexp matched the epxression before trying to use the submatch variables.
In this case, as the webpage returns "No match for anagram<br><br>", it won't match that regexp (and thus no submatches either).
Try something like this:
It's because the webpage returns "No match for anagram<br><br>". If you would post the output of a proper query, we could verify if your regexp matches the format used or not, and possibly fix it.
Well, I made EXACTLY your script, though I get the msg:
can't read "content": no such variable
while executing
"proc anagram:public {nick uhost hand chan text} {
if {![llength [set anagram [lindex [split $text] 0]]]} {
putquick "PRIVMSG $chan :Specify an anagram..."
(file "scripts/anagram.tcl" line 7)
invoked from within
"source scripts/anagram.tcl"
(file "eggdrop.conf" line 1343)
As long as the webpage returns "No match for anagram<br><br>", none of the scripts posted here will "work". And frankly, I'm not sure how to mine the data out of that (what would be "name" and what would be "answer" in that text), I'd rather guess this output would be some error message that the anagram was not found.
So, once again, please provide us with a valid result from that php-script so we know what to look for...
Space got lost in your link, but adding %20 instead of the space worked just well.
The problem with your regular expression is that ^ is interpreted as a special atom, namely beginning of line. You'll have to escape it within your regular expression to be able to match a ^-char explicitly.
The following should work well for you (using rosc's suggestions on implementation of the http-package):