【发布时间】:2023-03-29 15:02:02
【问题描述】:
我尝试在 sqlite 数据库上使用带有 python 的正则表达式检查带有模式的字符串。 当我尝试使用带有“的模式的搜索字符串”时遇到问题 例如:
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())
我应该在正则表达式之前 \" 其他方式编译器不喜欢...语法错误
[(1, 'aaa"test"')]
[] <????? should found
有人知道怎么做吗?
我的正则表达式函数:con.create_function("regexp", 2, regexp)
【问题讨论】: