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 } }
medicine in mexico pharmacies mexican pharmacy buying from online mexican pharmacy
pharmacy com canada Pharmacies in Canada that ship to the US best rated canadian pharmacy
https://mexicanpharmgrx.com/# purple pharmacy mexico price list
mexico pharmacy Pills from Mexican Pharmacy mexican pharmaceuticals online
canadian pharmacy online store: International Pharmacy delivery – certified canadian international pharmacy
northwest canadian pharmacy: List of Canadian pharmacies – canadian pharmacy meds review
http://canadianpharmgrx.xyz/# reliable canadian online pharmacy
canadian pharmacy tampa Best Canadian online pharmacy legitimate canadian pharmacy online
buy prescription drugs from india: indian pharmacy delivery – online shopping pharmacy india
https://mexicanpharmgrx.com/# best mexican online pharmacies
canadian pharmacy king My Canadian pharmacy canadian pharmacy
buying prescription drugs in mexico: Mexico drugstore – medication from mexico pharmacy
pharmacy website india: indian pharmacy delivery – online pharmacy india
indian pharmacy online indian pharmacy delivery online pharmacy india
canadian drug Canada pharmacy online canada pharmacy online
northwest canadian pharmacy: My Canadian pharmacy – cross border pharmacy canada
https://canadianpharmgrx.xyz/# canadian pharmacy no rx needed
india online pharmacy indian pharmacy delivery top online pharmacy india
reputable canadian online pharmacies Certified Canadian pharmacies canadian pharmacy store
http://mexicanpharmgrx.shop/# mexico pharmacies prescription drugs
buying prescription drugs in mexico: medicine in mexico pharmacies – mexican pharmacy
reliable canadian online pharmacy: Pharmacies in Canada that ship to the US – canadian online pharmacy reviews
indian pharmacy Generic Medicine India to USA pharmacy website india
mexican pharmaceuticals online: online pharmacy in Mexico – buying prescription drugs in mexico
mexico pharmacy Mexico drugstore mexico pharmacies prescription drugs
https://mexicanpharmgrx.com/# mexican pharmacy
indian pharmacy Healthcare and medicines from India online shopping pharmacy india
buying prescription drugs in mexico: mexican pharmacy – purple pharmacy mexico price list
online canadian pharmacy review Canada pharmacy canadian pharmacy world reviews
http://mexicanpharmgrx.shop/# mexican pharmaceuticals online