Joomla中的自定义URL字段 - 删除mailto前缀

in Joomla I use a URL custom field (MAILTO schema) to display an email address. The problem is that Joomla insert mailto prefix twice in the code: once in href attribute and another one between link tags, like this:

<span class="field-value"><a href="mailto:myEmail@some.site" rel="nofollow" target="_blank">mailto:myEmail@some.site</a></span>

...and this is php code that manage its display:

defined('_JEXEC') or die;

$value = $field->value;

if ($value == '')
{
    return;
}

$attributes = '';

if (!JUri::isInternal($value))
{
    $attributes = ' rel="nofollow noopener noreferrer" target="_blank"';
}

echo sprintf('<a href="%s"%s>%s</a>',
    htmlspecialchars($value),
    $attributes,
    htmlspecialchars($value)
);

I would like to remove mailto prefix between link tags.

How to proceed? … perhaps with a regex rule? Problem, I’m not a developer…

Thank you for your help,

Lorenzo

Thank you for your Reply,I think you can try again.

My English is a little bad,some places may be Unclear expression. enter image description here

echo sprintf('<a href="%s"%s>%s</a>',
preg_replace("/(^(http|https|ftp):\/\/)|(^mailto:)/i","",htmlspecialchars($value)),
$attributes,
htmlspecialchars($value));


// you can test it
$value = "http://www.kinoki.at";
$value = "mailto:info@kinoki.at";
echo "<pre>";
print_r( preg_replace("/(^(http|https|ftp):\/\/)|(^mailto:)/i","",htmlspecialchars($value)));
echo "<pre>";exit;

You likely run into this issue because Joomla tries to cloak the e-mail address. Best would be to use the recommended way of showing the e-mail address, using the built-in e-mail cloaking functions.

echo JHtml::_('email.cloak', $value);

See also: https://docs.joomla.org/How_to_cloak_email_addresses