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 } }
Five Killer Quora Answers To Retro American Fridge Freezer retro american fridge freezer
See What Accident Attorneys Near Me Tricks The Celebs Are Utilizing accident Attorneys
The 15 Things Your Boss Wants You To Know About Lawyer For Car Accidents You’d
Known About Lawyer For Car Accidents attorney near me car accident
17 Signs You’re Working With Asbestos Exposure Mesothelioma mesothelioma attorney (Marylyn)
The 10 Most Scariest Things About Door Doctors Near Me
door doctors Near me
Guide To Organic Coffee Beans 1kg: The Intermediate Guide In Organic Coffee Beans 1kg coffee beans 1kg
5 Must-Know Porsche Key Shell-Practices You Need To Know For 2023 Porsche Carkey – Bagge-Ditlevsen-2.Blogbright.Net –
Why Electric Fire Suites Is Your Next Big Obsession electric fire suites for sale; Venetta,
Fireplace Wall Mount Tools To Enhance Your Life Everyday Wall Fires
Why No One Cares About Asbestos Injury Attorney mesothelioma lawyers
Asbestos legal fibres can cause mesothelioma.
The most well-known mesothelioma type is called mesothelioma pleural, which develops in the lining of the chest
cavity and the lungs.
Are You In Search Of Inspiration? Check Out G Spot Stimulators g-spot vibrators (Renato)
What’s The Current Job Market For Electric Fireplace Mantels Professionals?
Electric Fire
Five Killer Quora Answers To Integral Fridge Freezer Integral Fridge freezer
What Do You Think? Heck What Exactly Is Repair Car Key?
mobile car key repair Near me
Patio Outdoor Gas Heater Tools To Make Your Everyday Lifethe Only Patio
Outdoor Gas Heater Trick That Every Person Must Learn Patio Outdoor Gas Heater
Your Family Will Be Thankful For Getting This In Wall Fireplace fireplaces Shop
12 Companies Leading The Way In Wall Mount Fireplaces Modern Fireplace – Te.Legra.Ph –
Why Top Accident And Personal Injury Lawyers Still Matters In 2023 Accident Lawsuits
The Best Wood Burning Stove Near Me Tricks To Change Your Life
best wood Burning Stove
10 Things Your Competitors Help You Learn About Daftar Akun Togel Resmi Toto macau
20 Up-And-Comers To Watch In The Coffee Beans Coffee Machine Industry Coffee Beans Machine
How To Outsmart Your Boss Audi A3 Key Battery replacement audi car key (Chas)
You’ll Never Be Able To Figure Out This Best Accident Lawyer Near Me’s Secrets accident Lawyer Near
me (articlescad.com)
Pay Attention: Watch Out For How Accident Injury Attorney Is Taking Over And What Can We Do About
It accident Injury Lawyers
The Reason Why Adding A ADHD Diagnosis UK To Your Life Will Make All The Difference how can i get
an adhd diagnosis (https://Www.diggerslist.com)
Auto Locksmith Ignition Replacement Tools To Ease Your Daily Lifethe One Auto Locksmith Ignition Replacement Trick That Everyone Should Know auto locksmith ignition replacement
(Geneva)
The 10 Most Worst Treadmill Foldable Electric FAILS
Of All Time Could’ve Been Prevented home
20 Things You Need To Be Educated About Electric Fireplace
Wall fires
The 10 Scariest Things About Bmw Key program