Transformation complains about regular expression definition

I want to check password length in a html form. When I enter a regular expression, I can’t save the transformation. The same happens for the attribute “required”. The way the input is defined works well in any html tester.

<input 
  type="password" 
  placeholder="Zadejte heslo (musí obsahovat alespoň 6 znaků, z toho 1 malé písmeno)" 
  id="psw"
  name="psw"
  pattern="(?=.*[a-z]).{6,}" 
  onchange='check_pass();' 
  required />
Expected token '}', found ','.
/(?=.*[a-z]).{6 -->,<-- }/

'/' is an unexpected token. The expected token is '='. Line 151, position 168.

The required attribute can only be saved when written like this required="true".

The curly brackets have to be escaped by being doubled pattern="(?=.*[a-z]).{{6,}}".

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.