I have a string being grabbed from a page in the format "4m 26s", how can I strip this into just seconds?
Many thanks,
Simple regex will work:
var s = '21m 06s';
var m = /(\d{1,2})m\s(\d{1,2})s/.exec(s);
var mins = parseInt(m[1], 10);
var secs = parseInt(m[2], 10);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With