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 } }
https://kamagrakopen.pro/# KamagraKopen.pro
Tadalafil Easy Buy: cialis without a doctor prescription – Tadalafil Easy Buy
https://kamagrakopen.pro/# Kamagra Kopen Online
TadalafilEasyBuy.com Buy Tadalafil 20mg Tadalafil Easy Buy
https://kamagrakopen.pro/# kamagra 100mg kopen
buy generic 100mg viagra online: Order Viagra 50 mg online – Generic100mgEasy
Kamagra Officiele Kamagra van Nederland kamagra 100mg kopen
https://kamagrakopen.pro/# kamagra pillen kopen
TadalafilEasyBuy.com: cialis without a doctor prescription – TadalafilEasyBuy.com
Generic 100mg Easy: Generic 100mg Easy – Generic 100mg Easy
buy generic 100mg viagra online: Generic 100mg Easy – buy generic 100mg viagra online
https://kamagrakopen.pro/# kamagra kopen nederland
Kamagra Kamagra kamagra 100mg kopen
https://kamagrakopen.pro/# kamagra kopen nederland
https://generic100mgeasy.shop/# Generic 100mg Easy
cialis without a doctor prescription: Cheap Cialis – TadalafilEasyBuy.com
https://generic100mgeasy.com/# buy generic 100mg viagra online
Kamagra: kamagra pillen kopen – kamagra jelly kopen
generic sildenafil: buy viagra here – buy generic 100mg viagra online
Generic100mgEasy: Generic100mgEasy – sildenafil over the counter
https://generic100mgeasy.com/# buy generic 100mg viagra online
https://tadalafileasybuy.shop/# Tadalafil Easy Buy
Officiele Kamagra van Nederland: kamagra pillen kopen – Kamagra Kopen Online
https://kamagrakopen.pro/# Kamagra
Generic100mgEasy: Generic100mgEasy – Generic 100mg Easy
KamagraKopen.pro kamagra kopen nederland Kamagra Kopen
KamagraKopen.pro: KamagraKopen.pro – kamagra jelly kopen
https://generic100mgeasy.shop/# order viagra
https://tadalafileasybuy.shop/# Tadalafil Easy Buy
Tadalafil Easy Buy: cheapest cialis – Tadalafil Easy Buy