Skip to content

Archive for July, 2010


Big Homestar Safari Extension

Whenever I went to Apple seemed to be inviting me to join the Safari Developer Program.  It’s free, so why not.  But I figured if I’m going to be in the program I should at least write something.  So I wrote Big Homestar, a safari extension that makes everything on fill the browser window.  It even resizes as you resize the window.  This probably seems pretty trivial, but I don’t write much Javascript, so I’m pretty proud of it.

I submitted it to Apple for the gallery.  Then their server sent me an email saying that they reserve the right to do whatever and never talk to me again, or something like that.  But whether they like it or not, you can still get it here.


PCRE on the iPad

I’ve been working on an iPad application that relies heavily on preexisting regular expressions.   iPhone OS 3.2 doesn’t have much regular expression support, so naturally, I’ve been using RegexKitLite, a very easy to use Objective-C wrapper around the built-in ICU regex engine.  If you’ve never used it before I strongly recommend it.

Unfortunately, I found that I was having a lot of errors.   Turns out that ICU doesn’t support named capture groups, a feature many of these regular expressions required.   At first I thought, “Maybe I can go through them all and modify them so they didn’t need that feature,” but that would be far too tedious and inflexible for the future.  Then I thought, “Maybe I can add the feature to ICU, get it pushed into the release version then Apple will add it to the next update of the OS.”  Right.

I found that the best way to solve my problem would be to compile PCRE, the engine these expressions were originally written for (I think), for the iPad, which turned out to be very simple to do.  I also found ObjPCRE, an Objective-C wrapper that somebody had written a while back, but its interface seemed confusing and I never got it to work.  So I decided to figure out PCRE’s C API and write my own.  PCRE’s man pages are quite thorough and very helpful.  I only wish they had clear documentation of each function like Apple does.  Perhaps they’ve never heard of Doxygen.

Finally, I wrote PCRERegex, my Objective-C wrapper around PCRE.  It’s not very complete, I wrote it with a specific task in mind.  So don’t think you can just replace RegexKitLite with it just yet.  Maybe someday.  Maybe.

Go check it out on GitHub.