Why preg_replace delete the " " in href?

Example
The normal link syntax is:
HTML Code:
<a href="/mydir/mypag.html"> </ a>
output instead rewrites:
HTML Code:
<a href=mydir/mypag.html></ a>
How can you fix this error?