删除所有 包含attribute属性 的标签连同标签体一起删除

发布日期:2022-11-07
最后更新:2026-03-26 03:36:47
阅读:11,582
删除所有 包含attribute属性 的标签连同标签体一起删除 
RegularUtil.removeTagWithBodyByAttribute(str,"class") 
<input type="text" class="a"/> 
<input type="text" class="a"></input> 
<input type="text" class = "a"></input> 
<input type="text" class></input> 
<input type="text" class/> 
<input type="text" a="class"></input>(不匹配)

/**
* @param src src
* @param attribute 属性
* @return String
*/
public static String removeTagWithBodyByAttribute(String src, String attribute)