Almost. Assuming that you want the if statement to catch requests that don't start with a letter or digit, you just have to change is to add { } around the regular expression. In tcl, [ ] is interpreted specially.
Before when I just had the pub_exec ... "script.php $text" it worked, but the problem was that if someone execute the command ".fm query | echo oops". but bot would execute the command "echo oops", which can be a real serious vulnerabiliry. So what im trying to do is catch anything that is not a letter or number so that I can not even have the script execute unless if is so.
and now it works... if i do this ".fm query", it returns data. if i try to add more than one query like ".fm query1 query2" i get an invalid request. would i need to add something else to the regex to get it to count spaces too?