So the first !(.*) will be the trigger.
Then I want the next (.*) to be the search term(s).
Everything works fine if the search term is one word but if the term is broken by a space like !searchchan search words here the script fails.
So I need to make it take the second (.*) and extend to the end of the line and save it as a var. Then the regsub will then take it and break it into usable content the rest of the script can use.
Code: Select all
    bind pubm - * bind_search
    proc bind_search {nick uhost handle channel text} { 
      filter_mirc_codes
	set regexp {^!(.*) (.*) *$}
	if {[regexp -nocase -- $regexp $text -> searchchan search]} {
	  
	regsub -all -- {\*} $search % search
	set searchvar [list]
	foreach word [split $search] {
	lappend searchvar db.`searchcolum` like '%[mysqlescape $word]%'"
	}
	
	do sql stuff like getting results 
        where [join $searchvar " AND " ]
	AND SearchChannel LIKE '#%$searchchan%'
	}
}
Code: Select all
    proc filter_mirc_codes {} {
      upvar text text
      regsub -all -- "(\002|\017|\026|\037|\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?)"  $text "" text
}