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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -