I need below text to be find by using regex in Intellij
messageSource.getMessage("error1.test1",null, null)
messageSource.getMessage("error2.test2",null, null)
messageSource.getMessage("error3.test3",null, null)
messageSource.getMessage("error4.test4",null, null)
messageSource.getMessage("success",null, null)
messageSource.getMessage("error",null, null)
I need this to replace with below
messageSource.getMessage("error1.test1",null, Locale.ENGLISH)
messageSource.getMessage("error2.test2",null, Locale.ENGLISH)
messageSource.getMessage("error3.test3",null, Locale.ENGLISH)
messageSource.getMessage("error4.test4",null, Locale.ENGLISH)
messageSource.getMessage("success",null, Locale.ENGLISH)
messageSource.getMessage("error",null, Locale.ENGLISH)
Note: These are just some examples, but hundres of lines are there across the project. error1.test1, success these texts can be with . (dot) or without dot , no numerics involved (only alphabets)
I tired to some extend, but couldn’t finish exactly
messageSource.getMessage\(\"[a-zA-Z]*.[a-zA-Z]*",[null]*,[null]*
>Solution :
You may try the following find and replace, in regex mode:
Find: messageSource.getMessage\(\s*(\S+?)\s*,\s*null\s*,\s*null\s*\)
Replace: messageSource.getMessage($1, null, Locale.ENGLISH)