<script>
var str = '|||34||69|78||||';
str = str.match(/[^\|]+/g);
str = str&&str.join('|')||null;
alert(str);
</script>