I have strings like catApple
, catBoy
, catChild
, ... catRobIsAGoodBoy
, ... catZebraIsAnAnimal
as class names in my application.
Now I have to remove the cat
prefix from all class names. Using File Search in Eclipse I can search for cat[A-Z]
and that gives me all my matched class names (also ensuring that strings like cat)
are filtered out). Additionally I have to lowercase the new first character.
Can I use a $
operator in my replace command in some way and achieve this?
E.g. cat[A-Z]
gives me catMercedesIsACar
and I convert it to mercedesIsACar
.
Thanks.
Since Eclipse regex S&R feature does not support \l
/ \L...\E
operators that can be used in the replacement pattern to perform additional lower-casing operation, you can actually use Notepad++ to search and replace in many files.
In Replace in Files in NPP (press Shift + Ctrl + F), use
\bcat([A-Z])
and replace with \l$1
. The word boundary \b
will match cat
only at the beginning of the words. Note that Match case is ON.