hexo.extend.helper.register("uk_paginator", function(option) { const options = Object.assign({ base: "/", pagePath: "page/%d/", total: 1, current: 1, space: "...", sideSize: 5, midSize: 10, mainClasses: [], itemClasses: [], }, option); const pagePathReplaced = options.pagePath.replace('/', '\/').replace('%d', '\\d+'); console.log(pagePathReplaced); const regPagePath = new RegExp(pagePathReplaced); console.log(regPagePath); options.base = options.base.replace(regPagePath, ''); console.dir(options); let pageStructure = []; pageStructure.push(``); return pageStructure.join("\n"); });