You can find every occurence of "<" and ">" using the strScan function http://msdn.microsoft.com/en-US/library/aa866529(v=ax.50).aspx
Use that to find the location of the "<"s and matching ">"
Use SubStr http://msdn.microsoft.com/en-US/library/aa677836(v=ax.50).aspx to find what is between "<" and ">", and apply your replacement based on that (using strPoke http://msdn.microsoft.com/en-US/library/aa850123(v=ax.50).aspx)
A useful AX2009 string class that utiliseses these methods and that may be of some help can be found here http://axgeek.blogspot.co.uk/2010/04/string-function-class.html , it should not take much effort to convert to 2012.
Of particular interest to you is the replace method.
However it may be simpler to have the memo as "Hello, We need to confirm you that your %1 is successfully attached with your account no. %2.", and to insert the values using strFmt http://www.axaptapedia.com/index.php?title=StrFmt
Of course the .Net String.Replace method is also available. see http://msdn.microsoft.com/en-us/library/cc584291.aspx and http://msdn.microsoft.com/en-us/library/system.string.replace.aspx