Jump to content

replace each url with string


phorcon3

Recommended Posts

how come this script below

 

<script type="text/javascript">
var text = 'url 1 http://www.example.com url 2 http://www.example2.com haha';

var matches = text.match(/http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/);

for(var i = 0; i < matches.length; i++)
{
document.write(matches[i]);
}
</script>

 

only outputs: http://www.example.com

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.