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 } }
TadalafilEasyBuy.com Buy Tadalafil 20mg Buy Tadalafil 10mg
Generic100mgEasy: Generic 100mg Easy – Generic 100mg Easy
Generic100mgEasy: buy generic 100mg viagra online – Generic100mgEasy
https://generic100mgeasy.com/# Generic 100mg Easy
Generic 100mg Easy: buy generic 100mg viagra online – Generic 100mg Easy
Kamagra Kamagra Kopen Kamagra
https://kamagrakopen.pro/# Kamagra Kopen Online
https://kamagrakopen.pro/# Kamagra
Kamagra Kopen: kamagra kopen nederland – kamagra 100mg kopen
kamagra pillen kopen: kamagra kopen nederland – Kamagra Kopen
https://tadalafileasybuy.com/# Tadalafil Easy Buy
buy generic 100mg viagra online buy generic 100mg viagra online Generic 100mg Easy
Kamagra Kopen Online: kamagra pillen kopen – kamagra kopen nederland
https://kamagrakopen.pro/# Officiele Kamagra van Nederland
https://kamagrakopen.pro/# Officiele Kamagra van Nederland
http://generic100mgeasy.com/# Generic100mgEasy
Kamagra Kopen Online: Kamagra Kopen Online – kamagra jelly kopen
cialis without a doctor prescription: cialis without a doctor prescription – Tadalafil Easy Buy
Kamagra Kopen Online: kamagra 100mg kopen – kamagra kopen nederland
https://kamagrakopen.pro/# KamagraKopen.pro
Generic 100mg Easy Generic 100mg Easy buy generic 100mg viagra online
https://kamagrakopen.pro/# KamagraKopen.pro
https://kamagrakopen.pro/# Officiele Kamagra van Nederland
cialis without a doctor prescription: Buy Tadalafil 20mg – TadalafilEasyBuy.com
buy generic 100mg viagra online: buy generic 100mg viagra online – buy generic 100mg viagra online
The most severe complications from atrial fibrillation can occur when blood clots form in the heart, break apart, and travel to different components of the physique.
Generic 100mg Easy Generic 100mg Easy sildenafil over the counter
Officiele Kamagra van Nederland: KamagraKopen.pro – kamagra gel kopen
TadalafilEasyBuy.com: cialis without a doctor prescription – Buy Tadalafil 5mg
https://kamagrakopen.pro/# kamagra pillen kopen