我需要使用 javascript 使链接可点击,我认为正则表达式将是最简单的,更不用说最快的方法了。我希望所有链接都是可点击的,并且不重写已经存在的可点击链接。
Example:
Here is a link to visit http://www.example.com/page Please take a look <a href="http://www.example.com/page">here</a>.
Becomes: Here is a link to visit <a href="http://www.example.com/page">http://www.example.com/page</a> Please take a look <a href="http://www.example.com/page">here</a>.
Another example: Here is a link to visit http://www.example.com/page Please take a look here: <a href="http://www.example.com/page">http://www.example.com/page</a>
Becomes: Here is a link to visit <a href="http://www.example.com/page">http://www.example.com/page</a> Please take a look here: <a href="http://www.example.com/page">http://www.example.com/page</a>
And finally: <p id="demo">http://example.com/
<br><a href="http://example.com/123">http://example.com/123</a>
<br><a href="http://Google.ca/">http://Google.ca/</a></p>