Change shebang from /usr/bin/perl to /usr/bin/env perl so that user-local (perlbrew) perls will get used.
When using negative look behind set the sub-regexp to -i (not case insensitive) to avoid issues where some upper case letter sequence, like SS or ST, happens to correspond to a single char as lowercase and hits perls inability to match variable length regexps via negative look behind.
Support timestamps for begin/end with fractional seconds (so it'll handle postgresql's normal string representation of timestamps).

NB: This parses, but does not propertly handle, time zones.