phphtml-parsingremovechild

Remove an <input> tag with a specified name attribute


I want to replace a string such as:

<input type="hidden" name="id" value="12345" />

but the problem I have is that the value's value (12345) is different everytime so how can I do what I'm trying to do? ..I'm guessing regex' but haven't a clue.


Solution

  • preg_replace('/\<input type="hidden" name="id" value="[0-9]+" \/\>/is', '', $source)