19
7
I can write a regular expression in NP++ to find under_score_case
.
I can use TextFX in NP++ to change case to upper and lower case by highlighting and selecting.
How can I use either NP++'s Find/Replace or TextFX's find and replace to stitch these together and convert under_score_case
to camelCase
?
I want to learn how to do this in NP++ not use a script.
Sample input:
this is_a_line
some more_data_over_here
whoop de_do_da
Desired output:
this isALine
some moreDataOverHere
whoop deDoDa
The regex to match the underscores would be _([a-z])
. The replacement that I think exists, but I cannot find is something like _\toupper\1
.
Convoluted, but it works. – Freiheit – 2011-07-19T13:01:21.587
Notepad++'s failings with regex have caused me to come up with solutions like this before, specifically when I need to find and replace across lines or use special characters, like tab. – MBraedley – 2011-07-19T13:31:16.513
As an aside, has the project lead on NP++ (Mr. Ho as I recall) made any noises about introducing vim-like replacement support? Any plugins to support that? NP++ and TextFX are really powerful, they just need a bit more to stitch them together. – Freiheit – 2011-07-19T13:33:06.843
I don't really follow the project, but I imagine that he's constrained by the use of Scintilla. – MBraedley – 2011-07-19T13:39:49.447
1One caveat: If the second and subsequent character in each word is an uppercase letter, it is made lowercase, e.g.
ALL_CAPS
becomesallCaps
. – Gnubie – 2012-06-26T10:26:20.717