fix unit test that was broken by directory handling changes
added read_until_regexp_with_prefix based on Jurgen Richters implementation