Adjusted for multiline pattern matching