Add basic pattern validation and unit test.