我正在开发一个应用程序,该应用程序从不同的网站获取其内容。在获得的内容中有时会出现内部链接。我需要将http://www.olddomain.com添加到这些链接的href值中,以确保它们在我的应用程序中仍然能够正常工作。
数据存储在变量text中。
变量text包含:
<p style="text-align: right;">
Lots of text in here, with all kind of html tags, <br /><br />
when suddenly a link appears:
<a href="/niceinternalpage.html">Here!</a>
</p>
我需要的输出:
<p style="text-align: right;">
Lots of text in here, with all kind of html tags, <br /><br />
when suddenly a link appears:
<a href="www.olddomain.com/niceinternalpage.html">Here!</a>
</p>
提前感谢您!