allow custom word boundaries

use case: matching the end of the nearest sentence