Man*_*ana 0 c# regex asp.net whitespace removing-whitespace
我有一个文本框字段,我想调整输入的内容.
我不希望用户键入多于或少于6-10个字符.这是我的限制字符的正则表达式.{6,10} $我得到了这部分工作,但我也不希望用户输入空格(空格).现在我能够从输入的开头和输入的结尾检测空白,但是如果用户在文本的中间键入空格则不能.看例子.
" testing" = regulator detects the space in the beginning. regex i use ^[^\s].+[^\s]$
"testing " = regulator detects the space in the end. regex i use here is same as abow
"test ing" = regulator does not detect the space in the middle. tried different regex with no luck.
Run Code Online (Sandbox Code Playgroud)
我怎样才能创建一个能满足我所需要的调节器?