I have a string which can be :
X=Y
or
X
Here X and Y can be any word containing alphabets.
I want that when string is X=Y then X should in group 1 and Y in group 2
but when string is X then X should be in group 2.
So far I am able to get only this :
(\w+)=(\w+)
What should be the right regex for it?