JavaScript RegExp on steroids