Regular Expression to check the spaces and minimum entries in C#
I am using c# for programming!
I want to write one regular expression in c# which will check first and last space in a sentence and will allow spaces in between it as well as there should be minimumm 2 charater entry in field, no limit for maximum characters, no special keys are allowed (@,#,$ etc) character开发者_StackOverflow中文版s allowed
Please suggests!
It's not really clear exactly what you want. Your comment -- contradicting the question itself -- suggests something like this, perhaps...
^[A-Za-z0-9]+(?:\s*[A-Za-z0-9]+)+$
This means that the string must start and end with an alphanumeric, and all characters except the first and last must be either alphanumeric or whitespace.
精彩评论