Hi,
I'd like to use regular expressions in sqlite query, I using apsw module
but it doesn't work...Can you help me ?
My script:
import apsw
import re
path = 'db/db.db3'
#regexp function (extract from python-list discusion)
def regexp(expr, item):
reg = re.compile(expr )
return reg.match(item) is not None
con = apsw.Connection (path)
#create function
con.createscala rfunction("REGE XP", regexp)
cur = con.cursor()
#exampl
cur.execute("se lect foo from test where foo regex 'aa.[0-9])")
and the error is:
cur.execute('se lect foo from test where foo regex tata')
apsw.SQLError: SQLError: near "regex": syntax error
Thanks
I'd like to use regular expressions in sqlite query, I using apsw module
but it doesn't work...Can you help me ?
My script:
import apsw
import re
path = 'db/db.db3'
#regexp function (extract from python-list discusion)
def regexp(expr, item):
reg = re.compile(expr )
return reg.match(item) is not None
con = apsw.Connection (path)
#create function
con.createscala rfunction("REGE XP", regexp)
cur = con.cursor()
#exampl
cur.execute("se lect foo from test where foo regex 'aa.[0-9])")
and the error is:
cur.execute('se lect foo from test where foo regex tata')
apsw.SQLError: SQLError: near "regex": syntax error
Thanks
Comment