<?php
// link jira tasks
$text = preg_replace('#ABC-(\d+)#is', '<https://jira.example.com/browse/ABC-$1|ABC-$1>', $text);

$text = preg_replace('#\[ABC\][ ]?\((\d+)\)#is', '<https://jira.example.com/browse/ABC-$1|$0>', $text);

// link support bugs/tickets
if (preg_match('#(TICKET|BUG|SUPPORT)[\-| ](\d+)#is', $text, $match)) {
	$replace = '<https://support.example.com/passthru.php?item=' . $match[0] . '|' . $match[0] . '>';
	$text = str_replace($match[0], $replace, $text);
}

if (preg_match('#\[HOTFIX\][ ]?\((\d+)\)#is', $text, $match)) {
	$replace = '<https://support.example.com/passthru.mh?item=' . $match[0] . '|' . $match[0] . '>';
	$text = str_replace($match[0], $replace, $text);
}