I have been messing with this for while now and I hope you guys can help.
So I have a XSL variable like
<xsl:variable name="blah" select="'texttexttext texttexttexttext Note:texttexttexttext'" />
What I’m trying to do is first search for “Note:” in $blah. If it is found, add a line break before it like 
 . So the output will be like
blah-> "'texttexttext texttexttexttext 
Note:texttexttexttext'"
I’m able to search for the term using the usual contains function like:
<xsl:if test="(contains($blah,'Note:'))">true</xsl:if>
but I’m confused on getting replace/insert of line break
XSLT 2.0 comes with some nice regex functions.
By using the replace function as here :
You shall get the desired result. So basically, I am catching all before and after
Note:and I am just putting your line-break in between at the result.