I answered a question a few days ago on Yahoo! Answers where I helped (did all the work for) the question asker. They were asking for a way to parse text from a <textarea> and search for HTML-like elements that were named in a database (or an array, in my case).
Took a few hours to write a script, and I'm happy with how it turned out. Right now, the script only displays information for what it parses, but you can take this script and insert different functions rather than displaying the match.
It is all packed in one PHP file.
If you need an example of what to put in the textarea, try typing this in:
<data id="blah">Test</data> <img id="foo" src="http://www.daniweb.com/forums/myimages/statusicon/forum_new.gif"/> <img src=http://www.daniweb.com/forums/myimages/statusicon/forum_new.gif info=no_quotes/> <code id="bar">Test</code>
Hope you find this useful! I spent a lot of time on it, so I felt I owed it to myself to post it for others.