Avoid using ${^MATCH}

For some reason, it's causing uninitialized errors. For now, just
get the substring using string operations and the start and end of the
match.