#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?s)<(category) name="Content Server Categories:(.+?)">(.+?)</(category)>"
Local $sString = "<category name="Content Server Categories:FOLDER:test category">" & @CRLF & _
" <attribute name="test attribuut"><![CDATA[test]]></attribute>" & @CRLF & _
" <attribute name="test attribuut1"><![CDATA[test1]]></attribute>" & @CRLF & _
"</category>" & @CRLF & _
"" & @CRLF & _
"<category name="Content Server Categories:FOLDER1:FOLDER2:test category">" & @CRLF & _
" <attribute name="test attribuut"><![CDATA[test]]></attribute>" & @CRLF & _
" <attribute name="test attribuut1"><![CDATA[test1]]></attribute>" & @CRLF & _
"</category>" & @CRLF & _
"" & @CRLF & _
"<category name="Content Server Categories:FOLDER NAME:test category">" & @CRLF & _
" <attribute name="test attribuut"><![CDATA[test]]></attribute>" & @CRLF & _
" <attribute name="test attribuut1"><![CDATA[test1]]></attribute>" & @CRLF & _
"</category>" & @CRLF & _
"" & @CRLF & _
"<category name="Content Server Categories:FOLDER NAME: FOLDER NAME1:test category">" & @CRLF & _
" <attribute name="test attribuut"><![CDATA[test]]></attribute>" & @CRLF & _
" <attribute name="test attribuut1"><![CDATA[test1]]></attribute>" & @CRLF & _
"</category>" & @CRLF & _
"" & @CRLF & _
"<category name="Content Server Categories:FOLDER:test category name">" & @CRLF & _
" <attribute name="test attribuut"><![CDATA[test]]></attribute>" & @CRLF & _
" <attribute name="test attribuut1"><![CDATA[test1]]></attribute>" & @CRLF & _
"</category>"
Local $sSubst = "<$1-$2 name="Content Server Categories:$2">$3</$1-$2>"
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