modified snippet and fix the bug where it mistakenly find the start and
end of a sentence