//Simplelet text ="Mr Blue has a_blue b_car house and a_blue b_car";let result = text.replace(/a_([\w\-_]+) b_([\w\-_]+)/g,(a, b, c)=>{/**
* a: 正则匹配到的字符串
* b: a中捕获的第一部分([\w\-_]+) - 视正则公式而定
* c: a中捕获的第二部分([\w\-_]+) - 视正则公式而定
*/return"yellow";// 返回的值来匹配a});
console.log("result: ", result);//result: Mr Blue has yellow house and yellow
在查看 css to tailwindcss 中,行内样式需要进行匹配并转化成 tailwindcss 放置到原标签的 class 中。这部分有进行应用。