943,545 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 18th, 2008
0

Re: Validating to accept both number and char but needing at least 2 digits

/(/([\d]{2,10}[\w][/s])|([\w][\d]{2,10}[/s])|([\w][\d]{2,10}[\w][/s])|[\d]{2,10}[\w]|([\w][\d]{2,10})|([\w][\d]{2,10}[\w])/

or would I have to specify without white spaces too? This epxression could get really long depending on how complicated your requirements are, yes?
Thx
Reputation Points: 10
Solved Threads: 0
Light Poster
squarkman is offline Offline
42 posts
since Nov 2008
Dec 18th, 2008
0

Re: Validating to accept both number and char but needing at least 2 digits

Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Dec 19th, 2008
0

Re: Validating to accept both number and char but needing at least 2 digits

id say skip regular expressions as if your strin gis actually very long, its going to be quite a big expression. Also, you will not be able to count how many of the entered digits are numbers. Unless, you specify to the user where they need to put the numbers that is at the start or at the end, or something, regular wont do such a good job. Stick with a for loop and try to just count the number of occurances of numbers to be more than two. that should be sufficient to suit your need.
Reputation Points: 10
Solved Threads: 8
Junior Poster
sid78669 is offline Offline
195 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: resize an image
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Context problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC