Added check for Invalid Patterns
Added a test for Invalid Pattern