In BibLaTeX, how to delimit title and subtitle by a colon, but not when title ends with question mark?

With BibLaTeX, I'd like to separate title and subtitle with a colon, as is done in some citation styles. However, I'd like the mechanism to detect if the the title ends in a quotation mark and if it does, omit the subtitlepunct.

The documentation in §4.7.3 says:

\addcolon Adds a colon unless it is preceded by a comma, a semicolon, another colon, or a period.

Can I add "quotation mark" to that list? I.e., is there a solution that avoids \isdot?

\documentclass{article}

\begin{filecontents}{test.bib}
@book{testbook,
author = {A. U. Thor},
year = {2020},
title = {An example title?},
subtitle = {An example subtitle}
}
\end{filecontents}

\usepackage{biblatex}

\begin{document}
\nocite{testbook}
\printbibliography
\end{document}


You can declare acceptable punctuation before \addcolon with \DeclarePunctuationPairs. The default setting

\DeclarePunctuationPairs{colon}{*!?}


allows abbreviation dots, exclamation marks and question marks before a colon. After all other punctuation marks the colon is suppressed.

You probably want

\documentclass{article}

\usepackage{biblatex}

\DeclarePunctuationPairs{colon}{*}

\begin{filecontents}{\jobname.bib}
@book{testbook,
author   = {A. U. Thor},
year     = {2020},
title    = {An example title?},
subtitle = {An example subtitle}
}
\end{filecontents}

Note that \DeclarePunctuationPairs is usually language-specific and therefore usually needs to live in \DefineBibliographyExtras. This is not required in the MWE (which loads neither babel nor polyglossia), but may be very relevant in your real-world application. See Biblatex punctuation recognition for more details.