improved performance for small number of submatch
integrated documentation