How to make regexp to split a string by \

Hi guys,

How do we do this one? I have tried a multitude of things… I cannot split a string up by \, please see examples below. It must be a tricky answer.

var str1 = 'H\e\l\l\o';
var str2 = 'W-o-r-l-d';


console.log(str1);
console.log(str1.replace('\\','*'));

console.log(str1.split(/\\/gi));
console.log(str2);
console.log(str2.split('-'));

console.log(str2.split('-')[0]);

Hi Randell,

I appreciate you help on this.