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 } }
An impressive share, I just now given this onto a colleague who had been conducting a small analysis within this. Anf the husband in fact bought me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for your treat! But yeah Thnkx for spending time to go over this, I’m strongly over it and love reading regarding this topic. When possible, as you grow expertise, can you mind updating your blog site with additional details? It truly is extremely useful for me. Huge thumb up with this blog post!
I am so grateful for this post and thanks such a lot for sharing it with us.
กวาดบทความนี้ทำให้ข้าพเจ้าได้รับทิศทางและความพยายามอย่างมาก ข้อมูลที่นำเสนออย่างชัดเจนและกระชับช่วยให้เข้าใจเนื้อหาได้เป็นอย่างดี ข้าพเจ้าขอแสดงความซาบซึ้งมา ณ โอกาสนี้
และขอเชิญชวนท่านเข้าร่วมในกิจกรรมของ “Spade Gaming” ซึ่งเป็นเว็บไซต์ที่น่าสนใจและมีความหลากหลายของเกมให้ท่านได้สัมผัส หวังว่าท่านจะได้พบกับความสนุกที่ทรงคุณค่าเช่นเดียวกับที่ข้าพเจ้าได้รับ
I am usually to blogging i really appreciate your posts. This great article has really peaks my interest. Let me bookmark your website and maintain checking for brand new information.
Great knowledge, do anyone mind merely reference back to it
Upvc Repairs Near Me Tools To Make Your Daily Lifethe One Upvc Repairs
Near Me Trick That Everyone Should Learn Upvc Repairs near Me
20 Truths About Cerebral Palsy Compensation: Busted lawsuits
I really enjoy reading on this site, it holds fantastic articles .
i would be busy again doing some home decors this coming christmas, i’d be buying some new decors for the season“
Could The Window Doctor Be The Key To Achieving 2023? Double hung Window repair
Learn More About Upvc External Doors While Working From At Home upvc door handle (https://m.bornchamps.com/)
The Most Significant Issue With High Variance Slots, And How You Can Fix
It Best online slots; images.google.no,
Double Glazing Companies Near Me Tools To Streamline Your Daily
Lifethe One Double Glazing Companies Near Me Trick That Should Be Used By Everyone Know Double Glazing Companies Near Me
Unexpected Business Strategies That Aided Best
Online Shopping Sites Clothes Achieve Success Vimeo.com
5 Laws That Can Help The Sofa And Couch Industry Deep couch sectional
This web-site can be a walk-through rather than the information you wished about it and didn’t know who must. Glimpse here, and you’ll definitely discover it.
Very interesting points you have noted , regards for putting up.
I thought this says a lot, There’s no place like home.
“A Guide To Slot Strategies In 2023 Slot strategy (images.google.com.do)
You’ll Be Unable To Guess Malpractice Case’s Tricks malpractice
This Is How Togel Online Will Look Like In 10 Years’ Time
goblok
You’ll Never Be Able To Figure Out This Cerebral Palsy Lawyers’s Benefits
cerebral Palsy Lawyer
I ran into this page on accident, surprisingly, this is a amazing website. The site owner has done a great job writing/collecting articles to post, the info here is really insightful. Now i am going to bookmark this internet site so that I can revisit in the future.
I just was in essence really pleased to not mention delighted thinking of that We the sensation from debating while using guide of foreign folks, maybe even picked English tongue for helping many people correct after they recognized ordinarily the chatting worry. I just was in essence even specifically enthusiastic when currency.
It’s rare knowledgeable people with this topic, however, you be understood as there’s more you are referring to! Thanks
You’ll Be Unable To Guess Double Single Bunk Bed’s Secrets double single
bunk (toolbarqueries.google.bs)
Five Killer Quora Answers On Cerebral Palsy Attorneys cerebral Palsy attorney
The Little Known Benefits Of Window Repairs wooden
Pushchair Pram Tools To Help You Manage Your Daily Life Pushchair
Pram Trick Every Individual Should Be Able To Pushchair Pram
20 Quotes That Will Help You Understand Birth Injury Legal birth Injury Lawsuits