Regular expression for not empty

后端 未结 7 1265
执笔经年
执笔经年 2020-12-28 18:31

I need a Java regular expression, which checks that the given String is not Empty. However the expression should ingnore if the user has accidentally given whitespace in the

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-28 19:02

    ^\s*\S
    

    (skip any whitespace at the start, then match something that's not whitespace)

提交回复
热议问题