Regular expression for no white space at start or end, but allow white space in middle, but also allow only one char inputs:

后端 未结 2 1412
耶瑟儿~
耶瑟儿~ 2020-12-10 09:31

Regular expression for no white space at start or end, but allow white space in middle, but also allow only one char inputs:

The closest I have got is : ^([^\\

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 10:08

    Make everything after the first non-space character optional:

    ^(?=\S)[a-zA-Z0-9_\s-]*\S$
    

提交回复
热议问题