Get #InDesign Style by String
var root = app.activeDocument;
var result = getStyleByString(root, "Formatgruppe 2:Form\\:atgruppe 1:Zeichen\\:\\:format 1", "characterStyles", true);
$.writeln(result.name);
function getStyleByString(root, string, property, recreate) {
if (recreate == undefined) recreate = false;
stringResult = string.match (/^(.*?[^\\]):(.*)$/);
var cStyleName = (stringResult) ? stringResult[1] : string;
cStyleName = cStyleName.replace(/\\:/g, ":");
remainingString = (stringResult) ? stringResult[2] : "";
var newProperty = (stringResult) ? property.replace(/s$/, '') + "Groups" : property;
var cStyle = root[newProperty].itemByName(cStyleName);
if (!cStyle.isValid && recreate) cStyle = root[newProperty].add({name:cStyleName});
if (remainingString.length > 0 && cStyle.isValid) cStyle = getStyleByString (cStyle, remainingString, property, recreate);
return cStyle;
}