Seems to work OK for me with your sample text, except that the "www" is dropped in the text between the <div> tags, and I'm not sure if that's what you want.
<?php
$src = "this text isn't complete after the replacement, www.basenet.ch?id=5&clean=user i wonder why?";
$pattern = '(www|[a-zA-Z]+://)([^[:space:]]+)';
$txt = eregi_replace($pattern, "<div onclick=\"nWin('\\1\\2')\">\\2</div>", strip_tags($src));
header('Content-Type: text/plain');
echo $txt;
Output:
this text isn't complete after the replacement, <div onclick="nWin('www.basenet.ch?id=5&clean=user')">.basenet.ch?id=5&clean=user</div> i wonder why?