Extract matched regexp as a separate method