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 } }
where to buy amoxicillin 500mg without prescription: amoxicillin 500mg price – ampicillin amoxicillin
clomid sale: get cheap clomid without rx – buy cheap clomid without prescription
can i order clomid pill: can i order generic clomid no prescription – get clomid without rx
paxlovid pharmacy: paxlovid pill – paxlovid pill
The Free Online Backlink Checker! I Know Where You
Are Able To Find Person! seo 최적화 (http://www.hrcu.tv)
Too Much Payday Loan And Minute Card Debt? Try Consolidation gg포커 다바오
Reasons Why People Need Bank Loans 다바오 포커 충전 방법
How To Develop A Search Engine Friendly Website 구글 백링크 (rbenorthwesteng.com)