{"record":{"id":"70544889595fecba","repo":"Semantic-Org/Semantic-UI","slug":"name-must-be-a-valid-e-mail","errorCode":null,"errorMessage":"{name} must be a valid e-mail","messagePattern":"(.+?) must be a valid e-mail","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1256,"sourceCode":"    bracket : /\\[(.*)\\]/i,\n    decimal : /^\\d+\\.?\\d*$/,\n    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',","sourceCodeStart":1238,"sourceCodeEnd":1274,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1238-L1274","documentation":"This is a validation prompt used by Semantic UI's Form module. It is displayed when an input with the 'email' validation rule fails because the value does not match the email regular expression (form.js:1240). The prompt is retrieved via module.get.prompt() (form.js:440-442) with {name} replaced by the field's label. The 'email' rule function (form.js:1347-1348) tests the value against settings.regExp.email.","triggerScenarios":"A field is configured with rules: [{ type: 'email' }] and the user enters a value that does not match the email regex /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i. This includes missing '@', missing domain, invalid characters, or missing top-level domain.","commonSituations":"Users typing 'john' instead of 'john@example.com'. Email addresses with spaces or special characters. Internationalized email addresses with Unicode characters (not supported by this regex). Copy-pasted emails with trailing spaces or invisible characters. Emails from autocomplete that insert a display name.","solutions":["Ensure the user enters a properly formatted email address (this prompt IS the validation feedback).","Customize the prompt for clarity: settings.prompt.email = 'Please enter a valid email address for {name}'.","If supporting internationalized emails, override settings.regExp.email with a more permissive regex.","Add client-side formatting hints (e.g., placeholder='user@example.com') to guide user input."],"exampleFix":"// before\n$('.ui.form').form({\n  email: { rules: [{ type: 'email', prompt: '{name} must be a valid e-mail' }] }\n  // regex rejects unicode emails\n});\n\n// after\n$('.ui.form').form({\n  email: {\n    identifier: 'email',\n    rules: [{ type: 'email', prompt: 'Please enter a valid email (e.g., name@example.com)' }]\n  }\n});\n// Optionally override the regex for broader support:\n// $.fn.form.settings.regExp.email = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;","handlingStrategy":"validation","validationCode":"// Pre-validate email format before form submission\nfunction validateEmail(value) {\n  var re = /^[a-z0-9!#$%&'*+\\\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\n  return re.test(value);\n}\nvar email = $('#email-field').val();\nif (!validateEmail(email)) {\n  console.warn('Invalid email format:', email);\n}","typeGuard":"// Type guard: check if a string is a valid email per Semantic UI's regex\nfunction isValidEmail(value) {\n  if (!value || typeof value !== 'string') return false;\n  return $.fn.form.settings.regExp.email.test(value);\n}","tryCatchPattern":null,"preventionTips":["Use HTML5 type='email' inputs for native browser validation as a first check.","Add a placeholder like 'name@example.com' to guide correct input format.","Override settings.regExp.email if you need broader email format support."],"tags":["form","validation","email","regex","prompt","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}