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 } }
The very next time I read a blog, Hopefully it doesn’t disappoint me as much as this one. I mean, Yes, it was my choice to read through, nonetheless I actually believed you’d have something helpful to talk about. All I hear is a bunch of moaning about something that you can fix if you weren’t too busy looking for attention.
I’m amazed, I have to admit. Seldom do I come across a blog that’s equally educative and engaging, and let me tell you, you have hit the nail on the head. The problem is something too few folks are speaking intelligently about. I’m very happy I came across this in my search for something concerning this.
15 Best Pinterest Boards Of All Time About Masturbator Male Masturbators For Man
You have made some good points there. I looked on the web to learn more about the issue and found most people will go along with your views on this website.
Carrier Oils For Massage With Essential Oils
연산오피
I know of the fact that today, more and more people are attracted to surveillance cameras and the field of pictures. However, to be a photographer, you must first invest so much period deciding which model of photographic camera to buy and moving from store to store just so you may buy the most affordable camera of the brand you have decided to decide on. But it does not end just there. You also have to think about whether you should obtain a digital dslr camera extended warranty. Thanks for the good suggestions I accumulated from your blog site.
I was able to find good info from your articles.
Greetings! Very helpful advice in this particular article! It’s the little changes which will make the most significant changes. Many thanks for sharing!
What Is The Best Mobility Scooter To Buy Uk: 11 Things That You’re Failing To Do 6699101.xyz
– http://Www.6699101.Xyz,
See What Small Oil Filled Radiator Tricks The Celebs Are Making Use Of small
oil filled radiator (https://escortexxx.ca/author/oliviasomme/)
fertility clinics these days are very advanced and of course this can only mean higher success rates on birth;
This page certainly has all the information and facts I wanted concerning this subject and didn’t know who to ask.
It’s a shame you don’t have a donate button! I’d without a doubt donate to this superb blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to new updates and will share this site with my Facebook group. Chat soon!
Best Bunk Bed Ideas Tools To Ease Your Daily Lifethe One Best Bunk Bed
Ideas Trick That Every Person Must Learn Best bunk bed Ideas
After I initially commented I appear to have clicked on the -Notify me when new comments are added- checkbox and now whenever a comment is added I recieve 4 emails with the same comment. Is there a way you can remove me from that service? Many thanks.
Assessment Of Adult Adhd Explained In Less Than 140 Characters
adhd assessment for adults Leicester (https://www.i-hire.ca)
Are You Responsible For A Fridge Freezer With Water And Ice Dispenser Budget?
12 Best Ways To Spend Your Money fridge freezers With Water dispenser