Python 3.6. I'm trying to create a REGEXP function for sqlite3. I have the error : OperationalError: wrong number of arguments to function REGEXP()
Here is my code :
import sqlite3
import re
def fonctionRegex(mot):
patternRecherche = re.compile(r"\b"+mot.lower()+"\\b")
return patternRecherche.search(item) is not None
dbName = 'bdd.db'
connexion = sqlite3.connect(dbName)
leCursor = connexion.cursor()
connexion.create_function("REGEXP", 1, fonctionRegex)
mot = 'trump'
data = leCursor.execute('SELECT * FROM tweet WHERE texte REGEXP ?',mot).fetchall()
Thanks