最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to check special characters in a string using Yup? - Stack Overflow

programmeradmin11浏览0评论

For Example, Bank account number cannot have special characters and I would like to validate the user input using Yup and show error in case of special characters like @,#,$ etc and emoji's.

Main intention here is to know the use of regex with Yup.

Note: I can use Yup.oneOf and restrict the user just to enter the integers.

For Example, Bank account number cannot have special characters and I would like to validate the user input using Yup and show error in case of special characters like @,#,$ etc and emoji's.

Main intention here is to know the use of regex with Yup.

Note: I can use Yup.oneOf and restrict the user just to enter the integers.

Share Improve this question asked Jul 19, 2019 at 12:53 Nitin KumarNitin Kumar 1,5362 gold badges13 silver badges19 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

You can use Yup.matches(/* regex here */, /* error message */)

发布评论

评论列表(0)

  1. 暂无评论