Javascript 一行中的多个替换
我有一个代码,我想在这个代码中有多个替换。我的代码在这里Javascript 一行中的多个替换,javascript,string,replace,gist,Javascript,String,Replace,Gist,我有一个代码,我想在这个代码中有多个替换。我的代码在这里 /* Codded by @phaticusthiccy Telegram: t.me/phaticusthiccy Instagram: www.instagram.com/kyrie.baran */ const Asena = require('../events'); const {MessageType, MessageOptions, Mimetype} = require('@adiwajshing/baileys');
/* Codded by @phaticusthiccy
Telegram: t.me/phaticusthiccy
Instagram: www.instagram.com/kyrie.baran
*/
const Asena = require('../events');
const {MessageType, MessageOptions, Mimetype} = require('@adiwajshing/baileys');
const axios = require('axios');
Asena.addCommand({pattern: 'carbon ?(.*)', fromMe: true}, (async (message, match) => {
if (match[1] === '') return await message.sendMessage('Need Word!');
var respoimage = await axios.get(`https://carbonnowsh.herokuapp.com/?code=${match[1].replace(/#/gi, "%250A", /Ö/g, "%C3%96", /ö/g, "%C3%B6", /ü/g, "%C3%BC", /Ü/g, "%C3%9C", /Ğ/g, "%C4%9E", /ğ/g, "%C4%9F", /ş/g, "%C5%9F", /Ş/g, "%C5%9E", /ç/g, "%C3%A7", /Ç/g, "%C3%87")}&theme=blackboard&exportSize=3x&paddingVertical=200px&paddingHorizontal=200px&language=JavaScript`, { responseType: 'arraybuffer' })
await message.sendMessage(Buffer(respoimage.data), MessageType.image, {mimetype: Mimetype.png})
}));
哪里错了
.替换(/character/g,“新字符”
如何在一行中使用多个replace???而不是使用regex,您应该检查您可以像这样堆叠它们:
.replace(/#/gi,“%250A”).replace(/Ö/g,“%C3%96”)
等…哦,谢谢,我现在正在尝试。)