Regular expression for href=’

It is necessary to replace the href value of links (replace href='__.html'with href='/__.html')

do this

$txt = preg_replace("/href='[^/]/","href='/", $txt);

but a blank white page comes out. If

$txt = preg_replace("/href='[^\/]/","href='/", $txt);

then the links are replaced, but the result is like this
i.e. the first letter is cut off!

Answer 1, authority 100%

$txt = preg_replace("/href='([^']+)/","href='/$1", $txt);

That is, we replace everything after the quote that is not a quote( [^']), in the amount of more than one (+), slash + first occurrence ($1)

to only without a slash at the beginning:

$txt2 = preg_replace("/href='([^'\/]+)/","href='/$1", $txt);