Sun Ye

Results 1 comments of Sun Ye

同样遇到这个问题,做了一个插件(picgo-plugin-web-uploader-re)用于更复杂的正则替换: 新增了两个配置项 matchPattern 和 replacePattern,用于接收正则表达式的匹配模式和替换模式。在处理函数中,对解析出的 imgUrl 进行正则替换:`imgUrl.replace(new RegExp(matchPattern, 'g'), replacePattern)` 示例1:将 /images/uploaded/pic.jpg 替换为 https://cdn.example.com/pic.jpg: - matchPattern: "^/images/uploaded", - replacePattern: "https://cdn.example.com" 示例2:将任意文件路径 pic.jpg、images/test.png 等替换为带前缀的 URL,例如 https://cdn.example.com/pic.jpg、https://cdn.example.com/images/test.png: - matchPattern: ".*", - replacePattern:...