Java + JS去除網頁HTML標籤
同樣是工作上用到,在前(Javascript)、後端(Java、JSP)同樣都有的一個需求,就是必須將讀入的字串去除HTML Tag,以下是兩個範例:
var HTML = ""; HTML+= "<p>HTML P Tag String</p>"; HTML+= "<p><a href='/test/link.html'>HTML A Tag String</a></p>"; var htmlTagPattern = /<{1}[^>]{1,}>{1}/g; //HTML Tag Pattern var htmlSplit = HTML.replace(htmlTagPattern, ""); //移除HTML Tag console.log("htmlSplit : " , htmlSplit); //輸出htmlSplit : HTML P Tag StringHTML A Tag String
package CDIT.stanley; public class trimHTML { public static void main(String[] args) { String HTML = ""; HTML+= "<p>HTML P Tag String</p>"; HTML+= "<p><a href='/test/link.html'>HTML A Tag String</a></p>"; String htmlTagPattern = "<{1}[^>]{1,}>{1}"; //HTML Tag Pattern String htmlSplit = HTML.replaceAll(htmlTagPattern, ""); //移除HTML Tag System.out.println("htmlSplit : " + htmlSplit); //輸出htmlSplit : HTML P Tag StringHTML A Tag String } }
easy canadian pharm: canadian drug prices – canadian pharmacy 24h com
mexican online pharmacies prescription drugs xxl mexican pharm mexican drugstore online
Mega India Pharm MegaIndiaPharm MegaIndiaPharm
Cheapest online pharmacy: canadian pharmacy without prescription – Best online pharmacy
xxl mexican pharm: xxl mexican pharm – п»їbest mexican online pharmacies
Cheapest online pharmacy: Cheapest online pharmacy – online pharmacy delivery usa
discount drug pharmacy: discount drug pharmacy – discount drug pharmacy
best online pharmacy no prescription https://megaindiapharm.com/# Mega India Pharm
legal online pharmacy coupon code https://discountdrugmart.pro/# discount drug mart
discount drug pharmacy: discount drug mart pharmacy – drugmart
pharmacy coupons http://discountdrugmart.pro/# discount drug pharmacy
online pharmacy no prescription http://megaindiapharm.com/# Mega India Pharm
easy canadian pharm: easy canadian pharm – easy canadian pharm
discount drug mart pharmacy: discount drug mart pharmacy – canadian pharmacy discount coupon
best no prescription pharmacy https://xxlmexicanpharm.com/# medication from mexico pharmacy
pharmacies in mexico that ship to usa: xxl mexican pharm – xxl mexican pharm
discount drugs: discount drug mart – drug mart
Cheapest online pharmacy: family pharmacy – prescription drugs online
canadian pharmacy review: easy canadian pharm – canadianpharmacyworld com