2022-11-07
|
ZH
/** * 获取所有 包含attribute属性并且值=value 的标签与标签体 * 单标签只匹配有/>结尾的情况,避免与双标签的开始标签混淆 * 如class="a" : attribute=class value=a * style="width:100px;" :attribute=style value=width * [ * [整个
2022-11-07
|
ZH
/** * 根据属性名 删除标签(只删除标签,保留标签体) * @param src xml/html * @param attribute 属性名 * @return String */ public static String removeTagByAttribute(String src, String attribute) RegularUtil.removeTagByAttribute
2022-11-07
|
ZH
/** * 删除 tags之外的标签只写一次 "b" * 只删除标签不删除标签体 * @param src html * @param tags tags * @return String */ public static String removeTagExcept(String src, String ...tags)
2022-11-07
|
ZH
org.anyline.util.regula.RegularUtil /** * 删除所有标签的属性 * @param src html * @param attributes 属性 如果不传则删除所有属性 * @return String */ public static String removeAttribute(String
2022-01-25
|
ZH
获取所有超链接(a标签) 提取单标签+双标签 不区分大小写 0:全文 1:开始标签 2:标签name 3:标签体 (单标签时null) 4:结束标签 (单标签时null) 注意标签体有可能是HTML片段,而不是纯文本
2022-11-07
|
ZH
/** * 获取所有 包含attribute属性 的标签与标签体,不支持相同标签嵌套 * [ * [整个标签含标签体, 开始标签, 结束标签, 标签体, 标签名称], * [整个标签含标签体, 开始标签, 结束标签, 标签体, 标签名称] * ] * @param src xml/html * @param a
2022-11-07
|
ZH
删除所有 包含attribute属性 的标签连同标签体一起删除 RegularUtil.removeTagWithBodyByAttribute(str,"class") <
2022-01-25
|
ZH
放多情况下我们并不需要复杂的标签内容,只需要截取几个关键字 如提取商品名称和商品价格,而这两个值有可能是根其他内容混在一块的