refactored pattern validation in ModuleValidator