James Montgomerie’s World Wide Web Log

Using the Mac or iPhone's Built In Regex Routines

In which a convenient method of using POSIX regular expressions from Objective-C is presented.

It’s a common complaint that the Mac and iPhone platforms don’t have native support for regular expressions, but that’s not entirely true. If you drop down to the UNIX core, there’s an implementation of the old (and only partially busted) POSIX regular expression interfaces. Here, I’ll show a simple Objective-C wrapper class for them that lets you use them conveniently in Mac or iPhone apps.

Before I start, some preemptive remarks: There’s a lot wrong with POSIX regexes to modern eyes. Firstly, and most glaringly, the …


iPhone Images from Character Glyphs

WTFBar.png

In which a category allowing the creation of UIImages from Unicode characters, suitable for use as Tab Bar icons, is created, but a state of mild displeasure at the implementation of said category is engendered.

[If you just want code, with none o’ that darn readdin’, there’s a zip at the end of the post]

Adding a ‘test’ tab to my in-development iPhone app, I had a dilemma. My troublesome aesthetic sense was telling me that, despite being seen by no-one but me, it needed a good looking icon. My sense of efficiency, though, was telling me “No! Don’t …