Moved a pattern compiler outside a while loop.  Could save a bit of
processing time