小白求助各位大佬,html提取指定的内容,其他都不要的,正则表达式 怎么写?-灵析社区

木子弓长

const str = 'shflehoshofwe"label_name":"历史"lshdliflwefoiewoilfjnwo'; const regex = /"label_name":"(.+?)"/; const match = str.match(regex); if (match) { const value = match[0]; console.log(value); // 输出:"label_name":"历史" } else { console.log("未匹配到字符串"); }

阅读量:1

点赞量:0

问AI