Random Drake
  • @randomdrake
  • github
  • LinkedIn
  • Contact

Monthly Archives:: April 2010

Creating a Table of Contents from HTML in PHP with DOMDocument and No Regex

April 27th, 2010 — Technology

While hanging out in the Freenode ##php channel, a user came along asking how to create a table of contents from an HTML string by extracting the header elements. Many suggestions came through including using Regex or a jQuery solution. Using Regex to parse HTML in PHP is a bad idea and can get quite… Read more »

Professional Technologist


My name is David Drake. I am a father and technologist who revels in creating things and tackling difficult problems.


Appreciator of the outdoors. Enjoyer of good humans, cooking, aromatic coffee, and plants. Actor for many years. Very fond of science; particularly astronomy and quantum physics. Likes to grow things and travel. Commodore 64 tattoo. Fan of PBS, Apple, and The NY Times. Constantly learning and loves to teach.


Everything I say is my own opinion and not representative of any organization.

Recent Posts

  • I’ve Moved My Writing to Medium
  • Empathy as a Trait for Good Developers
  • Nurturing Passion – The Last 10 Years of My Relationship with Cannabis
  • Travels – Getting Back to Writing
  • Tomodachi – Entrepreneurship in the Face of the Great East Japan Earthquake


© 2007-2021 David Drake