Tag Archives: Tools

A simple PHP regular expression tester

I love making my own tools for the simple and mundane tasks I face during the day. One of those tasks is the repeated need for testing regular expressions that I am faced with when programming. Yes, there are a multitude of regular expression testers on the web today, and all of them have a laundry list of cool things they do. But none of them are mine, and none of them are necessarily simple. And few of them let you see how they work. So with that, I decided to take one of the many tools I’ve built for myself and offer it here for you.

My (very) simple regular expression is just that… a simple tester that takes a regular expression and a subject string and gives you back your matches as PHP would see them in your application. There is one small bit of robustness (I had to use robustness… the word is just so cool) added to this tester that will allow you to group your matches together (PREG_SET_ORDER) and allow you to include the string position of the match in the subject (PREG_OFFSET_CAPTURE). But that is where the robustness ends the simple kicks in again.

So if you want a simple little regular expression tester, or just want to see how I’ve coded mine, feel free to use my tester for your own needs. Have fun, stay curious and GO BIG.

Just your typical Manday, erm, Sunday

I’m not sure if I was lucky or unlucky today, but I can say that I had fun regardless of my fortune. A few weeks ago my wife had me pickup a work table for her. Well, it was really a solid core that had four 4 X 4 posts attached to it as legs. She really wants to add counter space to our kitchen and felt this was a good way to do it. The only thing was the table was about nine inches too wide.

A wide table is a useless table. It had to be shortened and the only way to do that was to run it through the table saw. Which is not really a difficult thing to do. When your saw is set up. But mine was still in the box it came in. Which meant I got to become Bob the Builder for a time.

The nice thing is that the assembly of this saw was not rocket science. It did take some time, but it wasn’t hard to do. In fact it was easy enough that I was able to set it up almost completely before we had to take a small break and head out for a little while.

See, three of my daughters were performing in a recital. So we had to head to Hayward in the middle of the day so they could awe the throngs of parents (all 10 of us) with their magical fingers and playing prowess. A nice little surprise in the midst of all this was that my daughter Alaynah was on the performance list. I had no idea she would be singing. And it was awesome.

The kids did great, the parents had fun, and after a little bit of snacking and mingling it was time to head home so I could get back to work on the saw. It didn’t take long to get the saw completed. I wish I could say that for cutting the door.

The door, as I said, was a solid core door. It was heavy. And it didn’t want to be cut. At least not by some small little table like the one I have. Don’t get me wrong. My saw is fine for cutting smaller pieces of wood. But for solid core inch and half think doors, making a seven foot long cut is probably too much to ask it to do.

In the end though the saw won. It did what saws do and it cut that door. And I was able to assemble it and give my wife the counter space she has wanted for a long time now. Plus I was able to to play with power tools. Heck, I was able to even build the power tool I used. Throw in the fact that I was able to watch about three minutes of football and I’d say today was a pretty cool day.

And if nothing else I now have even more surface in my kitchen to stack crap that never gets cleaned.