如何使用 Javascript 和正则表达式将 RSS 提要的描述标签中的多个图像解析到我的描述页面

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

本文关键字:描述 图像 我的 标签 正则表达式 RSS 何使用 Javascript      更新时间:2023-09-26

这是描述标签的示例

    <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>

如果你真的必须使用正则表达式(这不是你首先应该做的),那么你可以使用这个(相当简单)表达式:

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

现在包含一个包含所有图像标记的数组。