Here is my original post translated into trivial javascript:
http://seamons.com/projects/js/time_parse.html
<html>
<head>
<title>Time Parse</title>
<script>
function calculate () {
var s = document.getElementById('inputstr').value;
s = s.replace(/\b(\d+):(\d+(?:\.\d+)?)(?::(\d+(?:\.\d+)?))?/g, function
(zero, one, two, three) {
return (typeof three != 'undefined' && three.length)
? parseFloat(three) + 60 * (parseFloat(two) + 60 * one)
: parseFloat(two) + 60 * one;
});
document.getElementById('answer').innerHTML = s;
}
</script>
</head>
<body>
<form>
Input test string: <input type=text size=60 id=inputstr value="1 + 2:30 -
0:45:30.2 - 1:40.243"><br>
<input type=button onclick=calculate() value="Try it">
<span id="answer" style="border: 1px solid darkgreen; background:
green"></span>
</form>
</body>
</html>
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/