I get the following error:
couldn't compile regular expression pattern: quantifier operand invalid
while executing
"regexp -- $theq(Regexp) $subexp"
(procedure "moxquiz_ask" line 152)
invoked from within
"moxquiz_ask $botnick {} {} $quizconf(quizchannel) {}"
(procedure "mx_timer_ask" line 3)
invoked from within
"mx_timer_ask"
This is the code:
Code: Select all
# protect embedded numbers
if {[regexp "\[0-9\]+" $theq(Regexp)]} {
set newexp ""
set oldexp $theq(Regexp)
set theq(Oldexp) $oldexp
while {[regexp -indices "(\[0-9\]+)" $oldexp pair]} {
set subexp [string range $oldexp [lindex $pair 0] [lindex $pair 1]]
set newexp "${newexp}[string range $oldexp -1 [expr [lindex $pair 0] - 1]]"
if {[regexp -- $theq(Regexp) $subexp]} {
set newexp "${newexp}(^|\[^0-9\])${subexp}(\$|\[^0-9\])"
} else {
set newexp "${newexp}${subexp}"
}
set oldexp "[string range $oldexp [expr [lindex $pair 1] + 1] [string length $oldexp]]"
}
set newexp "${newexp}${oldexp}"
set theq(Regexp) $newexp
#mx_log "---- replaced regexp '$theq(Oldexp)' with '$newexp' to protect numbers."
}
If I understand corretly, the "$theq(Regexp)" includes braces, which aren't balanced.
Is there a way to prevent the bot from aborting the proc upon this error? I can't prevent the unbalanced braces in the file out of which the "$theq(Regexp)" is generated.
Thank you for your help,
tueb