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://sildenafiliq.xyz/# sildenafil 50 mg price
Kamagra tablets: Kamagra 100mg price – Kamagra Oral Jelly
https://sildenafiliq.xyz/# generic sildenafil
Generic Viagra online buy viagra online Generic Viagra online
buy kamagra online usa: kamagra best price – sildenafil oral jelly 100mg kamagra
Cheap Viagra 100mg sildenafil iq Cheapest Sildenafil online
http://kamagraiq.shop/# sildenafil oral jelly 100mg kamagra
cialis for sale cialis best price Buy Tadalafil 5mg
over the counter sildenafil: cheapest viagra – Viagra tablet online
sildenafil oral jelly 100mg kamagra: Sildenafil Oral Jelly – cheap kamagra
http://kamagraiq.shop/# Kamagra Oral Jelly
https://sildenafiliq.xyz/# Viagra online price
best price for viagra 100mg: buy viagra online – order viagra
Cheap Cialis: Generic Tadalafil 20mg price – Generic Tadalafil 20mg price
http://tadalafiliq.shop/# Buy Cialis online
Cialis 20mg price in USA cialis without a doctor prescription Cheap Cialis
http://sildenafiliq.com/# Viagra without a doctor prescription Canada
Buy Cialis online Buy Cialis online Cialis 20mg price
https://kamagraiq.com/# sildenafil oral jelly 100mg kamagra
Kamagra 100mg: Kamagra Oral Jelly Price – kamagra
http://kamagraiq.com/# Kamagra 100mg
http://sildenafiliq.xyz/# sildenafil over the counter
Cheap generic Viagra: sildenafil iq – Viagra Tablet price
sildenafil online best price on viagra order viagra
https://sildenafiliq.xyz/# sildenafil 50 mg price
viagra without prescription buy viagra online Generic Viagra for sale
cheapest viagra: best price on viagra – buy viagra here
https://kamagraiq.com/# cheap kamagra
Tadalafil price cialis best price cheapest cialis
http://sildenafiliq.com/# Buy generic 100mg Viagra online