#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?:^</?category-FOLDER|\G(?!^))\K\s*([\w:]+)(?!\S)"
Local $sString = "<category-FOLDER:test 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-FOLDER:test category>" & @CRLF & _
"" & @CRLF & _
"<category-FOLDER1:FOLDER2:test 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-FOLDER1:FOLDER2:test category>" & @CRLF & _
"" & @CRLF & _
"<category-FOLDER NAME:test 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-FOLDER NAME:test category>" & @CRLF & _
"" & @CRLF & _
"<category-FOLDER NAME: FOLDER NAME1:test 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-FOLDER NAME: FOLDER NAME1:test category>" & @CRLF & _
"" & @CRLF & _
"<category-FOLDER:test category name 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-FOLDER:test category name>"
Local $sSubst = "$1"
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