fix: fixed some regex bug in lib/index.js
update: update test case and refact some test code.