I am able to automatically make the first sentence of a float caption bold by following the approach given at Automatically bold first sentence of a floats caption. However, when I use the hyperref package, this method no longer works.
In the following MWE, the automatic bolding works or doesn't when \usepackage{hyperref} is commented or uncommented, respectively.
\documentclass{article}
\usepackage{caption}
\usepackage{etoolbox}
\usepackage{xstring}
\makeatletter
\newcommand\formatlabel[1]{%
\noexpandarg
\IfSubStr{#1}{.}{%
\StrBefore{#1}{.}[\firstcaption]%
\StrBehind{#1}{.}[\secondcaption]%
\textbf{\firstcaption.} \secondcaption}{%
#1}%
}
\patchcmd{\@caption}{#3}{\formatlabel{#3}}
\makeatother
\usepackage{hyperref}
\begin{document}
\begin{figure}[tb]
\caption{First sentence that should be bold. Second sentence should not be.}
\label{fig:figure1}
\end{figure}
\end{document}
Is there an alternative way to make the first sentence bold that works with hyperref?

