Laravel 5.4 - Validation with Regex [duplicate]
问题 This question already has answers here : Issue with Laravel Rules & Regex (OR) operator (3 answers) Closed 2 years ago . Below is my rule for project name: $this->validate(request(), [ 'projectName' => 'required|regex:/(^([a-zA-z]+)(\d+)?$)/u', ]; I am trying to add the rule such that it must start with a letter from a-z or A-z and can end with numbers but most not. Valid values for project name: myproject123 myproject MyProject Invalid values for project name: 123myproject !myproject