Formify Docs

Contains Special

Require at least one special symbol in a value.

Contains Special

Requires that a value contains at least one special character — any character that is not a letter or a digit.

Configuration

Config flagTypeDescription
containsSpecialbooleanWhen true, requires at least one special character.

With useForm

const form = useForm({
  initialValues: { password: '' },
  validationSchema: {
    password: { containsSpecial: true },
  },
});

With the V builder

import { V } from 'formify-js';

V.containsSpecial();

Default message

ScenarioMessage
No special character presentMust contain a special character

Examples

ValueResult
'pass!'✅ Valid
'pass word'✅ Valid (space counts as a special character)
'password1'❌ Invalid
'123456'❌ Invalid

Things to know

  • Spaces, punctuation, and symbols all count as special characters.
  • specialCharacters is the equivalent presence check — this rule exists so you can name the requirement explicitly alongside containsUppercase, containsLowercase, and containsNumber.

On this page