$request->validate([
'phone' => ['nullable', 'regex:/^[0][0-9]{1,2}-{0,1}[0-9]{3,4}-{0,1}[0-9]{3,4}$/'],
]);
先頭の1桁は0固定
^(0{1}
先頭は1〜3桁 0固定
\d{1,3}
Go to list of users who liked
More than 3 years have passed since last update.
$request->validate([
'phone' => ['nullable', 'regex:/^[0][0-9]{1,2}-{0,1}[0-9]{3,4}-{0,1}[0-9]{3,4}$/'],
]);
先頭の1桁は0固定
^(0{1}
先頭は1〜3桁 0固定
\d{1,3}
Register as a new user and use Qiita more conveniently
Go to list of users who liked