Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more: , +
I want the user to enter four or more words in a TextBox and It's optional
Is there a regular expression for that.
please Help
Posted
Comments
Deepak_Sharma_ 19-Apr-12 3:09am    
Four or more words or letters?
kareem salem 19-Apr-12 3:14am    
words I want the user to enter his full name
Sergey Alexandrovich Kryukov 19-Apr-12 3:18am    
Most of the user's won't be qualified... :-)
--SA

hi,
Try this expression:
HTML
ValidationExpression="^.{4,}$" 


for learn regular expersions read this article :
Learn Regular Expressions (RegEx) with Ease[]
 
Share this answer
 
v3
Hi there,

Use this JS in your button click.
JavaScript
function countWords(){
   var txt=$find("TextBox1");
   if(txt.value.split(' ').length < 4){
      alert("Please input 4 or more words")
      return false;
   }
   return true;
}


All the best..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900