Regex 在node.js中匹配后跟下划线的特定字母表
* 需要匹配所有包含_web或_mb的变量 *Regex 在node.js中匹配后跟下划线的特定字母表,regex,match,nodes,Regex,Match,Nodes,* 需要匹配所有包含_web或_mb的变量 * 这就是我所做的 正则表达式=/(web | mb)/g * * 使用上面提到的正则表达式得到了完美的结果。 1-*(web | mb)表示下划线后跟字母web或mb 2-|用于正则表达式或在正则表达式中,正则表达式需要放在圆括号内 最后的3-g代表全球 *你的问题是什么?你的正则表达式与网站管理员或嵌入式匹配,你确定要匹配它们吗? const paragraph = 'vendors/photographer/12342323123/photo
- 这就是我所做的 正则表达式=/(web | mb)/g *
*你的问题是什么?你的正则表达式与
网站管理员
或嵌入式
匹配,你确定要匹配它们吗?
const paragraph = 'vendors/photographer/12342323123/photos/3213/sdf32sd3_mb.jpg';
or
const paragraph = 'vendors/photographer/12342323123/photos/3213/sdf32sd3_web.jpg';
const paragraph = 'vendors/photographer/12342323123/photos/3213/sdf32sd3_mb.jpg';
const regex = /_*(web|mb)/g;
const found = paragraph.match(regex);
if(found !=null){
console.log("compress image");
}else{
console.log("do not compress image");
}
console.log(found);