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.

Quick Perl Regexp in VIM to format e-mails list

I have a list of e-mails that I extracted from MySQL as something like this: name@example.com firstname lastname name2@example.com firstname2 lastname2 name3@example.com firstname3 lastname3 and I want them to be in this format: firstname lastname firsntame2 lastname2 firstname3 lastname3 Using VIM, I can do: :% s/^/ / :% s/()s(w*)s(.*$)/2 3 1/ The last one is a bit more complex but uses the n-style references to parenthesed elements in the matching part.

Quick Perl Regexp in VIM to format e-mails list

I have a list of e-mails that I extracted from MySQL as something like this:
name@example.com firstname lastname name2@example.com firstname2 lastname2 name3@example.com firstname3 lastname3
and I want them to be in this format:
firstname lastname <name@example.com> firsntame2 lastname2 <name2@example.com> firstname3 lastname3 <name3@example.com>
Using VIM, I can do:
:% s/^/</ :% s/s/> / :% s/(<.*>)s(w*)s(.*$)/2 3 1/
The last one is a bit more complex but uses the n-style references t