相关疑难解决方法(0)

regexp python和sqlite的问题

我尝试在sqlite数据库上使用带有python的正则表达式检查带有模式的字符串.当我尝试使用"使用patern使用"搜索字符串时,我有问题例如:

cur.execute("insert into articles(id,subject) values (1,'aaa\"test\"')")
cur.execute("select id,subject from articles where id = 1")
print (cur.fetchall())

cur.execute("select subject from articles where  subject regexp '\"test\"' ")
print (cur.fetchall())
Run Code Online (Sandbox Code Playgroud)

我应该"在regexp之前其他方式编译器不喜欢...语法错误

[(1, 'aaa"test"')]
[] <????? should found 
Run Code Online (Sandbox Code Playgroud)

有人知道怎么做吗?

我的正则表达式函数:con.create_function("regexp",2,regexp)

python regex sqlite

10
推荐指数
1
解决办法
9711
查看次数

标签 统计

python ×1

regex ×1

sqlite ×1