modules/buffer: finish cleaning up
scripts/regex: use buffer module, refactor