The issue here is not the regex itself, but the unavoidable fact that JavaScript doesn't implicitly support string literals (i.e. ones where backslashes are interpreted as printed as opposed to denoting an escape sequence. Much more can read here).
Strings derived from any source other than source code are interpreted as literal by default, as demonstrated in this fiddle.
<script>
function splitTheString()
{
//test = escape("whatever\aaaaaa");
var test = document.getElementById("strToSplit").value;
a = test.split(/(\\|\/)/)[0];
alert(a);
}
</script>
<form>
Split this string:<br>
<input type="text" id="strToSplit">
<a href="javascript:splitTheString();">Split the string</a>
</form>