Dec-03-2021, 01:30 AM
(Dec-01-2021, 08:27 PM)bontwoody Wrote:#This works cursor.execute('SELECT Word FROM Tbwords WHERE word REGEXP ?',['^.?.?P.?.?.?RE.?.?C.?.?.'])
That's how cursors work. You pass the query, with params to be replaced as "?", and then the values that should be substituted in.
Quote:#This doesnt list=['.?.?P.?.?.?RE.?.?C.?.?.'] regex=list[0] re_end="$']" #end of re mask re_start="['^" #beginning of re mask sqltxt="'SELECT Word FROM Tbwords WHERE word REGEXP ?'," + regex cursor.execute(sqltxt)
You're not passing an argument to the cursor for the value in this example. You've modified your query to end with
WHERE word REGEXP ?',regex