I am trying to use jQuery to break right ascension and declination data into their constituents (hours, minutes, and seconds) and (degrees, arc-minutes, and arc-seconds), respectively from a string and store them in variables as numbers. For example:
$dec = "-35:48:00" -> $dec_d = -35, $dec_m = 48, $dec_s = 00
Actually, the data resides in a cell (with a particular class ('ra')) in a table. At present, I have gotten this far:
var $dec = $(this).find(".ra").html();
This gives me the declination as a string but I cannot figure out how to parse that string.
I figured out the regular expression (-|)+\d+
(this gives me -35 from -35:48:00) to get the first part. How do I use that in conjunction with my code above?