first(); $regex = $field->format; $regex = str_replace('regex:', '', $regex); try { $attributeName = trim(preg_replace('/_+|snipeit|\d+/', ' ', $attribute)); $decrypted = Crypt::decrypt($value); if (!$this->validateRegex($attributeName, $decrypted, [$regex]) && !is_null($decrypted)) { $fail(trans('validation.regex', ['attribute' => $attributeName])); } } catch (\Exception $e) { report($e->getMessage()); $fail(trans('general.something_went_wrong')); } } }