put backslash inside split code example

Example 1: put backslash inside split

var str = "active - error - oakp-ms-001 Volume Usage-E:\\ PercentUsed E:\\";
var match = str.match(/error - (.*?) ?Volume/);
if (match) {
    console.log(match[1]); // oakp-ms-001
}

Example 2: put backslash inside split

str = "active - error - oakp-ms-001 Volume Usage-E:\ PercentUsed E:\"

Example 3: put backslash inside split

str = "active - error - oakp-ms-001 Volume Usage-E:\\ PercentUsed E:\\";

Example 4: put backslash inside split

var parts = str.split("\\"); // Splits on a single backslash