Reputation: 487
I have this code which works for getting the part of the string BEFORE a character (in my case the character is ":")
var getMinutes = value.match(/([\d.]+) *:/)[1];
I need to make it work for getting the part of string after ":" too but im stuck
Upvotes: 0
Views: 50
Reputation: 1
You can try split. For example: value = "123:456" => value.split(":")[0] will return "123" while value.split(":")[1] will return "456"
Upvotes: 0
Reputation: 782488
Move the capture group to after the :
var getSeconds = value.match(/[\d.]+ *:([\d.]+)/)[1];
Upvotes: 2