Python unicode escape for RethinkDB match (regex) query
问题 I am trying to perform a rethinkdb match query with an escaped unicode user provided search param: import re from rethinkdb import RethinkDB r = RethinkDB() search_value = u"\u05e5" # provided by user via flask search_value_escaped = re.escape(search_value) # results in u'\\\u05e5' -> # when encoded with "utf-8" gives "\ץ" as expected. conn = rethinkdb.connect(...) results_cursor_a = r.db(...).table(...).order_by(index="id").filter( lambda doc: doc.coerce_to("string").match(search_value) )