如何选择取消关联的<a> urls with RegExp in JavaScript

时间:2016-06-27 21:59:40

标签: javascript regex

I have a variable that stores html code for a webpage. The html code may includes a set of urls, some of these urls are linked using the anchor tag but other may not linked using the tag.

How can I select the unlinked urls to replace them with a linked version.

Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore
magna https://www.google.com aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip
Duis aute <a href="https://www.google.com">google.com</a>
irure dolor in reprehenderit in voluptate velit esse

<a href="https://www.google.com">google.com</a>
https://www.google.com

0 个答案:

没有答案