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 } }
Kamagra: kamagra 100mg kopen – KamagraKopen.pro
kamagra kopen nederland kamagra pillen kopen kamagra kopen nederland
https://kamagrakopen.pro/# Kamagra Kopen
Officiele Kamagra van Nederland: kamagra kopen nederland – Kamagra
buy generic 100mg viagra online: Generic 100mg Easy – Generic100mgEasy
https://kamagrakopen.pro/# kamagra pillen kopen
http://generic100mgeasy.com/# Generic 100mg Easy
Tadalafil Easy Buy: Tadalafil Easy Buy – Cialis without a doctor prescription
Kamagra Kamagra Kopen kamagra pillen kopen
https://kamagrakopen.pro/# kamagra gel kopen
Tadalafil Easy Buy: Tadalafil Tablet – Tadalafil Easy Buy
https://generic100mgeasy.com/# Generic100mgEasy
cialis without a doctor prescription: cialis without a doctor prescription – TadalafilEasyBuy.com
https://kamagrakopen.pro/# kamagra 100mg kopen
kamagra gel kopen Officiele Kamagra van Nederland Kamagra
http://generic100mgeasy.com/# buy Viagra over the counter
Generic100mgEasy: buy generic 100mg viagra online – Generic 100mg Easy
TadalafilEasyBuy.com: Generic Cialis without a doctor prescription – Tadalafil Easy Buy
Generic100mgEasy: Generic100mgEasy – Generic100mgEasy
https://tadalafileasybuy.shop/# Cialis 20mg price in USA
https://tadalafileasybuy.com/# Tadalafil Easy Buy
TadalafilEasyBuy.com TadalafilEasyBuy.com Tadalafil Easy Buy
Generic 100mg Easy: buy generic 100mg viagra online – over the counter sildenafil
online meds without prescription
cialis without a doctor prescription: TadalafilEasyBuy.com – TadalafilEasyBuy.com
cialis without a doctor prescription: cialis without a doctor prescription – Buy Tadalafil 10mg
https://tadalafileasybuy.shop/# cialis without a doctor prescription
Generic 100mg Easy: buy generic 100mg viagra online – Generic100mgEasy
http://generic100mgeasy.com/# Generic100mgEasy
http://generic100mgeasy.com/# Generic Viagra for sale