You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm struggling with patterns usage and proper error display.
I would like to validate a range of number values, something like 1024-2048, and I have a pattern to express allowed number values (values between 1024 and 49151) : pattern: "^(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])-(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])$"
But the output for user is displayed as:
07:43:09.693Z - error: PATTERN should match pattern "^(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])-(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])$"
> 4 | "ports": "3000-302"
which is valid, but not readable to understand what is a valid input.
I would like to know if there is a way to force a message when an error occurs, for instance to use a description instead of the pattern value, or if any other mechanism exists to provide a more readable output without the need to put logic from error report ?
Thanks for your help !
The text was updated successfully, but these errors were encountered:
Hi,
I'm struggling with patterns usage and proper error display.
I would like to validate a range of number values, something like
1024-2048
, and I have a pattern to express allowed number values (values between 1024 and 49151) :pattern: "^(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])-(102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3}|[1-3][0-9]{4}|4[0-8][0-9]{3}|490[0-9]{2}|491[0-4][0-9]|4915[01])$"
But the output for user is displayed as:
which is valid, but not readable to understand what is a valid input.
I would like to know if there is a way to force a message when an error occurs, for instance to use a description instead of the pattern value, or if any other mechanism exists to provide a more readable output without the need to put logic from error report ?
Thanks for your help !
The text was updated successfully, but these errors were encountered: