Made it so that if a match is close to the start or the end of the chunk the match is extended to include the start or end of the chunk