Sanitize and validate user input
Define validation and sanitization rules for every form field with regex, length limits, and safe encoding. Returns clear error messages for invalid input.
Preview
Copy prompt
Write server-side input validation and sanitization for the following form fields: [List fields with their expected types]. For each field, define the allowed format or regex pattern, maximum length, whether it is required or optional, and how to safely encode the value before storing or rendering it. Use [Language/Library] and show the exact error message that should be returned when each validation rule fails.
More
Security
Prompts
