Regular expression for not empty

后端 未结 7 1262
执笔经年
执笔经年 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:01

    This should work:

    /^\s*\S.*$/
    

    but a regular expression might not be the best solution depending on what else you have in mind.

提交回复
热议问题