I have a form field that I want to match the following rules: at least 3 numbers then at least 7 a-z or A-Z letters, currently I have this but it does not work apparently because I get that my input is not valid even if I respect the rule I mentioned :
->add('NumberAcc', TextType::class, [
'constraints' => [
new NotBlank(),
new Regex('/[0-9]{3,},[a-z]{7,}/')
],
])
Any ideas? (I know it wont work with Maj letters right now but it doesn't work either with lowercase letters
012,abcdefgmatches. Is the comma in the middle a mistake or on purpose? Also, if you want to match uppercase letters too, includeA-Zor make it case insensitive. (/[0-9]{3,}[a-z]{7,}/i)Regexfor that. My guess is you wanta1b2c3d4e5...to be valid as well. Better useCallbackconstraint then.