I am trying to find some string pattern (`"isempty var0")out of some long String which i am getting while reading a file, i am not sure if Regex Applicable to my requirement?
To be more precise in the expected String pattern isempty
is a keyword and there would be some java variable next to it after some space.
Input Strings can be something like this:
"isempty var0 && v1== 56"
"v2 == 50 || isempty var1"
"Q3 == 100 || (isempty var2)"
"isempty var3"
"is thisnotisempty var4"
And expected output is:
"isempty var0"
"isempty var1"
"isempty var2"
"isempty var3"
null
Currently i am trying to find the pattern using String.contains(), String.CharAt(), String.indexOf() methods etc.
Though i am not sure if this can be solved with Regex?? If it can be can someone give some idea, What could be the Regex to find this kind of pattern?
Thanks!