日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java替换html中的样式

發布時間:2024/1/23 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java替换html中的样式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
package com.yz.yrh.integration;import java.util.regex.Pattern;/*** Created by Administrator on 2017/5/12.*/ public class RegexTest {public static void main(String [] args){String content="<p align=\"center\"> \t<b><span>耶穌就是答案</span></b> </p> <p align=\"center\"> \t<strong>作者:道格·巴契勒\n" +"\n" +"</strong> </p> <p align=\"left\"> \t<br /> </p> <p align=\"left\"> \tC Em F Dm Am </p> <p \n" +"\n" +"align=\"left\"> \tWhen I gaze up at the countless stars or on an endless sea, </p> <p align=\"left\"> \t當我凝視無\n" +"\n" +"垠的星空和無際的海洋 </p> <p align=\"left\"> \tE E7 Am D7 G G7 </p> <p align=\"left\"> \tMy mind may swim \n" +"\n" +"with questions, bewildering to me, </p> <p align=\"left\"> \t無數問號,在我心海里聚集彷徨, </p> <p \n" +"\n" +"align=\"left\"> \tF Dm Em Am F G7 C </p> <p align=\"left\"> \tBut then I look into Your book and seek Your face \n" +"\n" +"in prayer, </p> <p align=\"left\"> \t當我打開圣經,在禱告中尋求主面, </p> <p align=\"left\"> \tF Dm C Am \n" +"\n" +"F G7 C C7 </p> <p align=\"left\"> \tI’m satisfied remembering Your loving grace and care. </p> <p \n" +"\n" +"align=\"left\"> \t禰的慈恩與眷顧,總使我飽足歡暢 </p> <p align=\"left\"> \t<br /> </p> <p align=\"left\"> \t\n" +"\n" +"<b>副歌</b> </p> <p align=\"left\"> \tF G7 C Am F G Em </p> <p align=\"left\"> \tWhatever questions I may \n" +"\n" +"have whether great or small, </p> <p align=\"left\"> \t盡管心中裝滿問號,或大或小 </p> <p align=\"left\"> \tF \n" +"\n" +"G7 G Em Am </p> <p align=\"left\"> \tI know Jesus died to save me, and that He forgave me, </p> <p \n" +"\n" +"align=\"left\"> \t但我知救贖的主、赦我罪,將我恩膏! </p> <p align=\"left\"> \tF G7 C A A7 F G7 C </p> <p \n" +"\n" +"align=\"left\"> \tJesus is the answer to it all --- Jesus is the answer to it all. </p> <p align=\"left\"> \t耶\n" +"\n" +"穌是所有疑問的答案 耶穌是所有疑問的答案 </p> <p align=\"left\"> \tC Em F Dm Am </p> <p align=\"left\"> \tI \n" +"\n" +"have so many questions, I wonder in my heart, </p> <p align=\"left\"> \t許許多多的問題 在我心中輾轉: \n" +"\n" +"</p> <p align=\"left\"> \tE E7 AM D7 G G7 </p> <p align=\"left\"> \tHow something comes from nothing? \n" +"\n" +"When did forever start? </p> <p align=\"left\"> \t無中怎能生有? 何處是永恒之源? </p> <p align=\"left\"> \t\n" +"\n" +"F Dm Em F G7 C </p> <p align=\"left\"> \tWhy can’t I see Your glory? Where is the Promised Land? </p> <p \n" +"\n" +"align=\"left\"> \t為何禰的榮光我不得見, 哪里有應許的地土山川? </p> <p align=\"left\"> \tF Dm C Am F G7 C C7 </p> \n" +"\n" +"<p align=\"left\"> \tI’ll trust that You will lead me there if I can take you hand. </p> <p align=\"left\"> \t\n" +"\n" +"我相信只要抓緊禰的手,就必見到主面。 </p> <p align=\"left\"> \t<br /> </p> <p align=\"left\"> \t<b>副歌\n" +"\n" +"</b> </p> <p align=\"left\"> \tF G7 C Am F G Em </p> <p align=\"left\"> \tWhatever questions I may have \n" +"\n" +"whether great or small, </p> <p align=\"left\"> \t盡管心中裝滿問號,或大或小 </p> <p align=\"left\"> \tF \n" +"\n" +"G7 G Em Am </p> <p align=\"left\"> \tI know Jesus died to save me, and that He forgave me, </p> <p \n" +"\n" +"align=\"left\"> \t但我知救贖的主、赦我罪,將我恩膏! </p> <p align=\"left\"> \tF G7 C A A7 F G7 C </p> <p \n" +"\n" +"align=\"left\"> \tJesus is the answer to it all --- Jesus is the answer to it all. </p> <p align=\"left\"> \t耶\n" +"\n" +"穌是所有疑問的答案 耶穌是所有疑問的答案! </p>\n" +"<span style=\"color:#E53333;\">我們會定期發布視頻和文章,便于手機上網者閱讀和收看!</span>";//java替換html中的樣式content=content.replaceAll("[a-zA-Z]*=\".*\""," ");System.out.println(content);}}


替換結果如下:

<p > <strong>作者:道格·巴契勒</strong> </p> <p > C Em F Dm Am </p> <p > 當我凝視無垠的星空和無際的海洋 </p> <p > My mind may swim with questions, bewildering to me, </p> <p > 無數問號,在我心海里聚集彷徨, </p> <p > But then I look into Your book and seek Your face in prayer, </p> <p > F Dm C Am F G7 C C7 </p> <p > I’m satisfied remembering Your loving grace and care. </p> <p > <b>副歌</b> </p> <p > Whatever questions I may have whether great or small, </p> <p > F G7 G Em Am </p> <p > I know Jesus died to save me, and that He forgave me, </p> <p > F G7 C A A7 F G7 C </p> <p > 耶穌是所有疑問的答案 耶穌是所有疑問的答案 </p> <p > I have so many questions, I wonder in my heart, </p> <p > 許許多多的問題 在我心中輾轉: </p> <p > How something comes from nothing? When did forever start? </p> <p > F Dm Em F G7 C </p> <p > Why can’t I see Your glory? Where is the Promised Land? </p> <p > F Dm C Am F G7 C C7 </p> <p > 我相信只要抓緊禰的手,就必見到主面。 </p> <p > <b>副歌</b> </p> <p > Whatever questions I may have whether great or small, </p> <p > F G7 G Em Am </p> <p > I know Jesus died to save me, and that He forgave me, </p> <p > F G7 C A A7 F G7 C </p> <p > 耶穌是所有疑問的答案 耶穌是所有疑問的答案! </p> <span >我們會定期發布視頻和文章,便于手機上網者閱讀和收看!</span>
推薦一個不錯的調試正則的網址:http://tool.chinaz.com/regex/

總結

以上是生活随笔為你收集整理的java替换html中的样式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。