refactored regex generation to allow for multiple patterns