I am trying to use a regex to search/replace a pattern / substitution / in vim.
I have a Java file which is trying to check if a weather data variable is set and if it is do one thing, if not omit it from being processed into JSON format. I wrote a method in a different class ( called StumpJunk.isSet - works just like PHP isset by checking if null or empty)
The old way I was doing it was if (varName != null)
The new pattern I want it to be is if (StumpJunk.isset(varName))
I have tried multiple regex methods in VIM to no luck:
:%s/if (\(.*\)) != null)/(StumpJunk.isSet(\1))/g :%s/if \(\(.*\)\) \!\= null\)/\(StumpJunk.isSet\(\1\)\)/g :%s/if \v\((.*)\) \!\= null\)/(StumpJunk.isSet(\1))/g :%s/if \v\((.*)\) \!\= null\)/(StumpJunk.isSet("\1")/g
Every time it comes back saying pattern not found:
Pattern not found: \vif\((.*) \!\= null\)