Update pattern matching for orphaned lines (todo: multiline match)