Refactored regex class