[1.8.x] Fixed #24221 - Used precompiled regexp for percent-placeholder matching.
[1.8.x] Fixed #24221 - Used precompiled regexp for percent-placeholder matching.

Backport of ea0ea7859a224225950a4df7c23eb3a7d823ddcd from master

h4r5h1t/django-hauthy,h4r5h1t/django-hauthy,pquentin/django,pquentin/django,pquentin/django,h4r5h1t/django-hauthy,h4r5h1t/django-hauthy