开发者

Regular Expression to check the spaces and minimum entries in C#

开发者 https://www.devze.com 2023-01-15 16:57 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消