Ganesh Ganesh - 1 year ago 59
Java Question

regular expression for underscore and space

I am new to

regular expressions
. I want to write a regular expression which will check ,if a string has more than 1 word then that string has a
in between them or not . And also , which will check that string has space before it or not
. for example
,this should check it has space before that and underscore in between words.So,How can i write that?


If you want to do it by regex, it would be something like


It matches a space \s, a sequence of at least one (the +) letter (upper or lower case), an underscore _ and another sequence of at least one letter.

See it here at regex101.