Monthly Archives: August 2004

java.util.regex.Pattern StackOverflowError’s on (x|y)*

I’ve been doing a fair whack of regex processing in Java recently. I must admit that having a regex library in the language is very useful, and Java’s java.util.regex.Pattern implements a very complete regex library (all the “Perl5″ stuff, non-greedy quantifiers, Unicode character classes, etc).

So I was completely surprised when it started throwing StackOverflowError. The following code highlights the problem (reproduced on Sun’s JDK1.5.0-b2 and JDK1.4.2_01). Any pattern like (x|y)* (an alternative wrapped in a star) is implemented recursively by Pattern. Each matched alternative uses about 5 method calls on the stack.

A perfect example of how IDEA *just works*

People I know who use Eclipse ask me why I use IntelliJ IDEA, when Eclipse is really good and free. Well, it’s little gems like the following that put IDEA miles above anything and everything else.

Back from reef

Just back from a two week holiday (”vacation”) in Port Douglas. There is nothing like a fortnight of swimming, sleeping, walks, naps and hazelnut gelato to re-charge the batteries. If you ever have the chance to visit the Great Barrier Reef, I highly recommend going for a snorkel/dive, it was awesome. I spent all day yesterday clearing my build-up of support [...]