Various improvements.

Pattern building uses table buffers (and `table.concat()`).
Replaced semi-broken regex escaping with (quicker) `escape_regex()`.
Removed `add(self, ...)` in favour of `self:append_pattern(...)`.