I have a piece of html code as string:
<input id="an_id" name="a_name" value="some_value" class="a_class" type="text"/>
I want to get rid of the name attribute and its value with a regex and preg_replace:
preg_replace('/name\="(.*)"/', '', $html, 1);
But this outputs:
<input id="an_id" />
Can anybody help me? Why does it delete that much? The regex is name
for the attribute and (.*)
because I don't care what char is in the value. There can be anything.