Added all test cases to and fixed a bug in method markByPattern().