Site icon Hip-Hop Website Design and Development

The gettext hook doesnt work on text with links

Searched for awhile and looked at the codex https://developer.wordpress.org/reference/hooks/gettext – still cant find an answer.

The below function works perfectly when you are on the reset password page. There is only text to replace.

 
function my_gettext_filter( $translations, $text, $domain ) {
if ( ( $text == 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ) ) {
$translations = '<span style="font-weight:bold;">' . $translations . '</span>';
}
return $translations;
}
add_filter( 'gettext', 'my_gettext_filter', 10, 3 );

But…when I try and use the same function on the page that follows which says "Check your email for the confirmation link, then visit the login page." It doesnt work because login page text is inside anchor tags so it doesnt find an exact match. Does anybody know a way around this?