I'm currently recoding some of my PHP code into javascript code for my node.js server.
My PHP-Reqex looks like this:
$timevalue = "W5D4H7M34S12";
$aSplitted = preg_split('#(?<=\d)(?=[a-z])#i', $timevalue);
The result for $aSplitted looks like this:
["W5","D4","H7","M34","S12"]
This is what I tried in javascript:
var aSplitted = timevalue.split(/(?<=\d)(?=[a-z])#i/g);
Or
var aSplitted = timevalue.split((?<=\d)(?=[a-z])#i);
Or
var aSplitted = timevalue.split('(?<=\d)(?=[a-z])#i');
but it wont work.
I've also tried something like this:
var aSplitted = timevalue.split(/[^A-Za-z]/);
But it only gives me the chars without the numbers after.
Maybe some of you know the solution?