Unitrai

preg_match(): No ending delimiter '^' found Laravel Full Name Validation Rules

5 June 2020

The regex caused the error during validation check on Alphaspace Rules regular expression for below regex: return preg_match('^[a-zA-Z\s]+$',$value); To fix the issue add delimiters to regex, below is the right regex: public function passes($attribute, $value) { return preg_match('/^[a-zA-Z\s]+$/

The regex caused the error during validation check on Alphaspace Rules regular expression for below regex: return preg_match('^[a-zA-Z\s]+$',$value); To fix the issue add delimiters to regex, below is the right regex:
public function passes($attribute, $value) {

return preg_match('/^[a-zA-Z\s]+$/',$value);

}
# note / slash in start and end of the regex
#Web

Share this post