#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?:\b(?=\w)|\B(?!\w))\(*\b[CDEFGAB](?:b|bb)*(?:\+|\#{1,2}|dim|sus|maj|min|aug|[mM°0-9])*\(?[\d\/]*\)?(?:[CDEFGAB](?:b|bb)*(?:\#{1,2}|dim|sus|maj|min|aug|[mM°0-9])*[\d\/]*)*\)*(?:\b(?<=\w)|\B(?<!\w))"
Local $sString = "F#" & @CRLF & _
"Angel eyes," & @CRLF & _
"G#m" & @CRLF & _
"Why won’t you let me apologise?" & @CRLF & _
"Foul"
Local $sSubst = "<span class="_c">$1</span>"
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