Some tests and style updates for #1229

@tobibeer I simplified the handling of matched strings a little.