following the rule of thumb never to trust data received from end users before putting it to good use, i tried one of the core validators' match. before placing it as pattern, ive tested the expression using online regex101 and regex debugger match sample string in 6 steps. However, when i put it in my rule and tried it, i got invalid input.
here's what i did:
public function rules()
{
return [
[['name', 'code'], 'required'],
[['name'], 'string', 'max' => 40],
['name','match','pattern'=>'/^([\w ]+)\z/i'],
[['code'], 'string', 'max' => 9],
['code','match','pattern'=>'/^(?:[0-1])(?:[0-9])[0]+\z/'],
[['name','code'], 'unique','attributes'=>['name','code']],
];
Here's the input:
region-regex-invalidInput
Please help needs assistance