preg_replace href值仅当在其中找不到字符串x时

I have a problem with the following situation

I want to replace the href value with preg_replace and dont know how

I got 3 types of links

1:<a href="http://www.something.com"></a>
2:<a href="smartlink:webview-something"></a>
3:<a href="link/to/something"></a>

I want to add the domain on link 3 (http://www.something.com/link/to/something) but 1 and 2 should stay untouched.

How can i do that?

Try this:

 $new_link = preg_replace("/href=\\"(?!(http|smartlink))(.*)\\">/", "http://www.something.com/$2", $str);

Click on preg_replace
http://www.phpliveregex.com/p/fJ9