I have the following string
let string = "01,15,01,45"
Which i want to turn to this
string = "01:15 - 01:45"
but i'm only able to come up with
"01,15,01,45".replace(/,/g, ':') // Gives "01:15:01:45"
but then i'm not sure how to get the index of the 5th position in string and replace it to ' - '
Any suggestion will be helpful.
"01,15,01,45".replace(/(\d\d),(\d\d),(\d\d),(\d\d)/, "$1:$2 - $3:$4")