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 } }
buy generic 100mg viagra online: Generic 100mg Easy – Sildenafil Citrate Tablets 100mg
Kamagra Kamagra Kopen Online kamagra 100mg kopen
https://kamagrakopen.pro/# kamagra pillen kopen
kamagra jelly kopen: kamagra pillen kopen – Kamagra Kopen
TadalafilEasyBuy.com: Tadalafil Easy Buy – Buy Tadalafil 5mg
TadalafilEasyBuy.com: п»їcialis generic – TadalafilEasyBuy.com
https://generic100mgeasy.shop/# over the counter sildenafil
TadalafilEasyBuy.com: TadalafilEasyBuy.com – cialis without a doctor prescription
http://generic100mgeasy.com/# buy generic 100mg viagra online
Kamagra Kamagra Kamagra Kopen
Generic 100mg Easy: Generic100mgEasy – Generic100mgEasy
kamagra kopen nederland: kamagra gel kopen – kamagra 100mg kopen
https://kamagrakopen.pro/# Officiele Kamagra van Nederland
http://tadalafileasybuy.com/# Tadalafil Easy Buy
Tadalafil Easy Buy: Tadalafil Easy Buy – TadalafilEasyBuy.com
Tadalafil Easy Buy: Tadalafil Easy Buy – TadalafilEasyBuy.com
https://tadalafileasybuy.shop/# Tadalafil Easy Buy
Sildenafil 100mg price: Sildenafil Citrate Tablets 100mg – buy generic 100mg viagra online
sildenafil 50 mg price Generic100mgEasy Generic 100mg Easy
Generic 100mg Easy: Generic100mgEasy – Generic 100mg Easy
https://generic100mgeasy.shop/# Viagra tablet online
https://generic100mgeasy.com/# Generic Viagra for sale
Cialis 20mg price in USA: Tadalafil Easy Buy – Tadalafil Easy Buy
Tadalafil price TadalafilEasyBuy.com Cialis over the counter
https://generic100mgeasy.com/# buy generic 100mg viagra online
buy generic 100mg viagra online: Generic100mgEasy – Generic100mgEasy
https://generic100mgeasy.shop/# Generic100mgEasy
http://generic100mgeasy.com/# Viagra without a doctor prescription Canada
https://kamagrakopen.pro/# kamagra kopen nederland
Tadalafil Easy Buy: TadalafilEasyBuy.com – TadalafilEasyBuy.com