# Replace specified tags in PHP

**URL:** <https://forum.kirupa.com/t/replace-specified-tags-in-php/256673>\
**Category:** programming\
**Created:** [April 5, 2008, 3:49pm UTC](https://forum.kirupa.com/t/replace-specified-tags-in-php/256673 "2008-04-05T15:49:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunetics](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lunetics](https://forum.kirupa.com/u/lunetics)\
**Post date:** [April 5, 2008, 3:49pm UTC](https://forum.kirupa.com/t/replace-specified-tags-in-php/256673/1 "2008-04-05T15:49:31Z")

</div>

Take a look at the HTML example below:

```auto

<html>
<body>
    <h1>Click on the button below:</h1>
    <Com:Button Text="Click here" />
</body>
</html>

```

I want to search for the tag name “Com” --\> Search for it´s prefix “Button” --\> Get the param “Text” and replace the whole tag with \<input type=“button” value=“Click here” /\>. How can this be done in an effective way?

---

<div class="post-metadata">

**Author:** ![lunetics](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lunetics](https://forum.kirupa.com/u/lunetics)\
**Post date:** [May 25, 2008, 8:08pm UTC](https://forum.kirupa.com/t/replace-specified-tags-in-php/256673/2 "2008-05-25T20:08:27Z")

</div>

I think I continue here… Anyone who have an solution for extending the DOM class in PHP5 so you can use elements like \<com:Button /\> when parsing (X)HTML documents?
