JavaScript preg_match

In the context of a nasty (wrong) SCORM package, I had to find a method of quickly parsing a time representation like "PT03H23M34S" and transform it into "03:23:34". After a few quick searches on how to do user string.replace(), I had to change the method, because apparently replace() doesn't allow for selection identifiers (2 and the likes) in the replacement string, or at least I didn't find how to do it. So I ended up with this:
if (/[A-Z]{2}d{2}Hd{2}Md{2}S/i.test(param)) { param = param.split(/D+/).join(' ').trim().split(/S/).join(':');}
It *is* kind of a one-liner.

Easy SCORM 1.2 creation - Extending the Dokeos export

Today I had to explain to a customer how to register time and completeness in a SCORM learning path, considering he's got Flash content and he doesn't know anything about SCORM. This is what I answered (with little changes) The idea is that Dokeos deals with SCORM contents by providing a JavaScript API (a library that can be called from the Flash) to enable SCORM features. To enable this, there are various steps that need to be taken... 1. Your content should be a SCORM package. 2. Each step of your content should send a LMSInitialize() call to the Dokeos SCORM API when opened. 3.


I sure am discovering a lot of interesting stuff on the net this week. I'm just done reading and watching a video on the eLML website. First reaction: interesting project. Apparently, some of the developers of fellow e-learning management system OLAT are involved in the development of eLML as well. eLML is just an XML schema for writing learning content.