Ruby 1.8.6 does not support look-behind using its default regular expression engine. To get this support, I needed the Oniguruma library and gem. Installation was a bit confusing on Mac OS X Leopard. These blog posts were helpful to get me started:
- Juju explains how to build Ruby from source with Oniguruma patched in. I didn’t try his approach; it was (sufficiently) more
advancedcomplicated than I needed. - The Oniguruma RubyForge home warns of a painful Mac OS X installation and refers us to a nice, but slightly out-of-date, write-up.
So, here is my (currently) up-to-date version, no Ruby recompilation needed:
# Install Oniguruma library
cd ~/sources
wget wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz
tar -xvzf onig-5.9.1.tar.gz
cd onig-5.9.1
./configure
make
sudo make install
# Libraries installed in: /usr/local/libsudo gem install oniguruma
# Successfully installed oniguruma-1.1.0
# Ignore RDoc warning about oregexp_initialize
I’ve tested this on my Mac Book Pro and two Ubuntu Gutsy servers.
Update: Goodbye Helicopter has up-to-date Oniguruma installation instructions for Mac OS X. They are essentially the same as what I showed above.
Post a Comment