#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?P<project_id>\w+)(-)(?P<jira_id>\d+)"
Local $sString = "KEY-6" & @CRLF & _
"At least for jira this is the plugin request ticket for the encryption plugin KEY-662" & @CRLF & _
"KEY-662" & @CRLF & _
" wanted to follow up on KEY-668 were you able to add people to the project you needed?" & @CRLF & _
"" & @CRLF & _
"https://jira.service.desk/servicedesk/customer/portal/1/KEY-668" & @CRLF & _
"[mm](https://jira.service.desk/servicedesk/customer/portal/1/KEY-668)" & @CRLF & _
"KEY-6"
Local $sSubst = "[${project_id}-${jira_id}](https://jira.service.desk/servicedesk/customer/portal/1/${project_id}-${jira_id})"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm