java - Eclipse Regex Search and Replace Swap places -


i have code on class:

if (src.gettyperecord().getact().equalsignorecase("b")) 

now can crash if getters return null, , team's best practices, asked convert into:

if ("b".equalsignorecase(src.gettyperecord().getact())) 

i have come following regex search easier case of had value assigned variable act.equalsignorecase("b"):

(\w*).equalsignorecase\("(\w*)"\) 

replace with:

"\2".equalsignorecase(\1) 

which works except cases mentioned above, , this:

tos.substring(1,1).equalsignorecase("a") 

could please come search , replace regex catch 2 examples mentioned above? need account situations opening if bracket adjacent, , there space if ( src.... or if (src....

thanks!

just changing should work :

\b([\s]*?).equalsignorecase\("(\w*)"\) 

take @ example here @ rubular .


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -