re: Regex Bootcamp (or Nobody Seems to be Using HTML5 Validation) VIEW POST

re: Regexes are easy and useful in the backend, but I feel like they are extremely user-unfriendly. How do I explain the "requested format" to the end ...

You realize regex's ARE declarative? "Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions":


Sure, and you could even reverse-engineer some messages, but you'd get something like

Phone must begin with "00" or "+" or nothing, followed by "1" or "7" or "20" or "27" or "3...

Whereas with a proper syntax description you could automatically insert a "+", delete a leading "00", and if the following two digits aren't a real country code have an informative error like

Please include the country code in the phone number

code of conduct - report abuse