簡體   English   中英

如何使用Javascript和regex將RSS feed的描述標簽中的多張圖像解析到我的描述頁面

[英]How can i parse the Multiple images in the description tag of my RSS feed to my description page using Javascript and regex

這是描述標簽的示例

    <description>
    On 5th September, 2013 ICSK Junior Branch students expressed their love and respect                                for their teachers.<div align=center><img src=http://www.example.com/press//press/sep2613focus1.jpg></div> <div       align=center><img src=http://www.example.com/press//press/sep2613focus3.jpg></div>
     The  highlight of the day was address by Principal Incharge, educating children on the significance of the Day. Indeed a touching day for the teaching fraternity of ICSK. <div align=center><img src=http://www.example.com/press//press/sep2613focus4.jpg></div> More ICSK News at <a href="http://www.icsk-kw.com" target = "_blank">www.icsk-kw.com</a>
    </description>

如果確實需要使用RegEx(首先應該這樣做),則可以使用以下(相當簡單)的表達式:

// description contains the text that you provided
images = description.match(/<img src=[^>]+>/g);

圖像現在包含具有所有圖像標簽的數組。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM