use string.prototype.match instead of regular express exec() function due to the performance consideration