{"record":{"id":"d650334a8173b4b4","repo":"Semantic-Org/Semantic-UI","slug":"name-is-not-formatted-correctly","errorCode":null,"errorMessage":"{name} is not formatted correctly","messagePattern":"(.+?) is not formatted correctly","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1258,"sourceCode":"    email   : /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,\n    escape  : /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,\n    flags   : /^\\/(.*)\\/(.*)?/,\n    integer : /^\\-?\\d+$/,\n    number  : /^\\-?\\d*(\\.\\d+)?$/,\n    url     : /(https?:\\/\\/(?:www\\.|(?!www))[^\\s\\.]+\\.[^\\s]{2,}|www\\.[^\\s]+\\.[^\\s]{2,})/i\n  },\n\n  text: {\n    unspecifiedRule  : 'Please enter a valid value',\n    unspecifiedField : 'This field'\n  },\n\n  prompt: {\n    empty                : '{name} must have a value',\n    checked              : '{name} must be checked',\n    email                : '{name} must be a valid e-mail',\n    url                  : '{name} must be a valid url',\n    regExp               : '{name} is not formatted correctly',\n    integer              : '{name} must be an integer',\n    decimal              : '{name} must be a decimal number',\n    number               : '{name} must be set to a number',\n    is                   : '{name} must be \"{ruleValue}\"',\n    isExactly            : '{name} must be exactly \"{ruleValue}\"',\n    not                  : '{name} cannot be set to \"{ruleValue}\"',\n    notExactly           : '{name} cannot be set to exactly \"{ruleValue}\"',\n    contain              : '{name} must contain \"{ruleValue}\"',\n    containExactly       : '{name} must contain exactly \"{ruleValue}\"',\n    doesntContain        : '{name} cannot contain  \"{ruleValue}\"',\n    doesntContainExactly : '{name} cannot contain exactly \"{ruleValue}\"',\n    minLength            : '{name} must be at least {ruleValue} characters',\n    length               : '{name} must be at least {ruleValue} characters',\n    exactLength          : '{name} must be exactly {ruleValue} characters',\n    maxLength            : '{name} cannot be longer than {ruleValue} characters',\n    match                : '{name} must match {ruleValue} field',\n    different            : '{name} must have a different value than {ruleValue} field',\n    creditCard           : '{name} must be a valid credit card number',","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1240-L1276","documentation":"Default prompt for the Semantic UI Form `regExp` rule (settings.rules.regExp, form.js:1357). Shown when a field's value does not match a caller-supplied regular expression. The rule accepts either a RegExp object or a string (with optional `/pattern/flags` syntax parsed via `settings.regExp.flags`, form.js:1362-1376) passed as the bracketed ancillary value or `rule.value`.","triggerScenarios":"Field rule `{type:'regExp[/^[A-Z]{3}$/]'}` with input `ab` or `abcd`; or `{type:'regExp', value:/\\d{4}/}` with input `abc`. Any value for which `value.match(regExp)` is falsy triggers the prompt.","commonSituations":"Typo in the bracket-delimited regex (unescaped `]`, missing flags), passing a string regex with `/` delimiters inconsistently, or a regex that does not anchor and unexpectedly matches/fails. Also: forgetting that an empty value still runs the rule (use `empty`/`optional` first).","solutions":["Verify the regex against the intended input in a regex console first.","Pass the pattern as a real RegExp object via `rule.value` to avoid `/.../ ` parsing edge cases.","Escape brackets inside the pattern or use `rule.value` when the pattern itself contains `[`/`].`","Add a custom `prompt` so the failure is actionable, e.g. `'Use 3 uppercase letters'`."],"exampleFix":"// before - bracket parser confused by inner brackets / unanchored\nrules: [{ type: 'regExp[/[A-Z]{3}/]' }]\n\n// after - pass RegExp object + clear prompt\nrules: [{ type: 'regExp', value: /^[A-Z]{3}$/, prompt: 'Code must be 3 uppercase letters' }]","handlingStrategy":"validation","validationCode":"const pattern = /^[A-Z]{3}$/; // your rule\nif (!pattern.test($field.val())) { /* show inline guidance */ }","typeGuard":"const isRegExpRule = (r) => r && (r.value instanceof RegExp || typeof r.type === 'string' && /\\[.*\\]/.test(r.type));","tryCatchPattern":null,"preventionTips":["Pass RegExp objects via rule.value instead of bracket strings to avoid parser edge cases.","Unit-test the pattern against representative pass/fail inputs.","Anchor patterns (^...$) unless partial matching is intended."],"tags":["semantic-ui","form-validation","regex","client-side"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}