How apply regexp for validate number? How to change message for required?
See original GitHub issueI’m trying to validate a number field.
Yup.object().shape({
temperature: Yup.number()
.min(0, 'Minimal value 0')
.max(30, 'Maximum value 30')
.matches(/^([0]([.][0-9]+)?|[1-9]([0-9]+)?([.][0-9]+)?)$/, {
message:'Inccorect format. Example 25 or 25.1',
excludeEmptyString: true
})
.required('Temperature is required. Please enter value from 0 till 30')
})
I got error if apply matches for number,
and I can not to change message for required. I got default message.
- How apply regexp for validate number?
- How to change message for required?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to change validation message only for Regex pattern ...
and following com it is giving regex message as "Please match the requested format"..How can we change this message to a meaningful one.But...
Read more >Examples of javascript form validation using regular expressions
In this tutorial you will see how to use regular expressions to validate. Through a list of examples , we will build a...
Read more >Form Input Validation Using Only HTML5 and Regex - Code
Let's say you want to make sure that usernames are only alphanumeric. This can be done easily with the help of the pattern...
Read more >Restricting Text Responses With Regular Expressions
To use a regex in KoboToolbox, follow these steps¶ · Prepare a Text question type. · Go to the question's Settings. · Go...
Read more >Form Validation In JavaScript Using Regular Expression
This video on Validation in JavaScript will let you know everything about how a user's data can be validated with the help of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is how I tested for number and for regex; I used
mixed
and wrote custom tests.@zhrvdns Would you mind showing how you accomplished this? And thanks @jquense for this awesome validation tool.
Thanks!