I would like to include regexp in my Tcl project, but when I run my code, I get this error:
no such function: REGEXP
my code is as follows:
return [brain eval "select * from bad WHERE input REGEXP '^(.){0}_'"]
I can check this exact code in the database (I use a BD browser for SQLite to view the database) and it works correctly:
select * from uniq WHERE input REGEXP '^(.){1}0'
20 Lines returned from: select * from uniq WHERE input REGEXP '^ (.) {1} 0' (took 18 ms)
So REGEXP will work in the browser, but not in my Tcl Script. Here is what I have found so far on this issue:
, , - , , , . , sqlite3? , ?
?
file mkdir db
sqlite3 db ./brain/brain.sqlite -create true
db eval { create_function('regexp', 2) do |func, pattern, expression|
func.result = expression.to_s.match(
Regexp.new(pattern.to_s, Regexp::IGNORECASE)) ? 1 : 0
end
}
, !