﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15927	FORMAT_QMARK_REGEX in sqlite backend does not work as expected	anonymous	nobody	"FORMAT_QMARK_REGEX is not correct (in django/db/backends/sqlite3/base.py).

It uses a lookahead assertion trying to not match if the char before the ""%s"" is not ""%"" but lookahead assertion can't be used to do that (it is for looking ahead not behind).

Example:

{{{
In the regex '(?!..)b' applied on 'abc' the '..' will match 'bc' so:
 - re.search(r'(?!a)b','abc') => match 'b'
 - re.search(r'(?!b)b','abc') => no match
}}}

I don't think this regex could be writen with lookhead assertions.

A possible solution could be:
{{{
re.compile(r'(^|[^%])%s').sub(r'\1?','%s %%s %s')
}}}"	Bug	closed	Database layer (models, ORM)	1.3-rc	Normal	duplicate			Accepted	0	0	0	0	1	0
