I try to check a string with a pattern using a regex with python on a sqlite database. I have problem when I try de search string having \" with a patern using \" For exempl
You can use triple escapes, or a raw string.
Your doing:
>>> print("select subject from articles where subject regexp '\"test\"' ")
select subject from articles where subject regexp '"test"'
Use a raw string, which is a r'string with a r in front':
>>> print(r"select subject from articles where subject regexp '\"test\"' ") select subject from articles where subject regexp '\"test\"'
Or triple escapes (\\\):
>>> print("select subject from articles where subject regexp '\\\"test\\\"' ")
select subject from articles where subject regexp '\"test\"'