Work around bug in boost regex library

Works around bad_alloc exception in boost::find_regex for
boost 1.47 (and possibly others).