Closed senthilsendhil closed 8 years ago
Your regex does not allow for empty string. Try this one:
^([0-9,*._]{0,10})$
@senthilsendhil Hi! I just noticed the regex I gave you had a slight error. I already corrected it.
However, were you able to solve the problem that you were facing? Do you need any help?
@AlphaGit Its was working, one more doubt , I like to make some dynamic regs like i want to set length dynamic ^([0-9,*._]{0,
Sure! In that case you probably will want to use the * quantifier, which will match zero or more elements of the expression to the left of it. I recommend checking this site out, that helps in understanding and testing regular expressions: https://regex101.com/
Hi @senthilsendhil! Were you able to solve the problem you were having?
Hi ,
Sorry for late reply , yes I solved , I got new problem, hope you can help?
I want to restrict user entry for date format
Hi, here's an example even using the library: https://plnkr.co/edit/QHgV7m9jlSLPImxcFif2?p=preview
Thanks lot , its worked , also I am trying to modify dd/mm/yyyy with if its date user can enter only 01 - 31 and for month 01 - 12 ...
The regex expression for such restriction will be really complicated, since I understand that the next step will be to use the right amount of days in the right months, and consider leap years.
You're really best suited (and will have less problems) using a date input or a date widget.
Just so you have a glance, this is the validation for days 1-31, without considering the right months:
(0?[1-9]|[12][0-9]|3[01])?
@senthilsendhil I'll be closing this ticket. If you have any questions regarding the library or project, feel free to open a new ticket. If you have more questions about regexes, I really suggest looking into some documentation in them for JavaScript (MDN is a great resource) or ask in StackOverflow. I also have no problem with helping out but it's a little bit outside of the scope of the project, but you can contact me through some other medium.
Thanks!
in above regs.. i cant empty the string.. where to add /d??