In Notepad++, how can I replace a certain character (.
) that is enclosed within two brackets []
throughout a large file?
Explanation
I have a very long code dump file (of PeopleCode) in Notepad++. At the top of each section of code, there is a tag like this:
[G3FORM.FormFactory.OnExecute]
This denotes a class package, and a class. In addition, this can be multiple layers deep:
[Y_REST.RESTQueries.ExampleClass.OnExecute]
Whenever a class is declared in the code, it doesn't use .
's. It uses :
's. E.g.:
import G3FORM:Form;
So, when I want to search for that class in the code dump, I have to change all of the .
's into :
. I can do that, but it's somewhat annoying.
Example
I would like some help with Notepad++'s regex search feature for find and replace. I need to replace all of the .
's contained within these headers with :
's. E.g.:
[Y_REST.RESTQueries.ExampleClass.OnExecute]
would become
[Y_REST:RESTQueries:ExampleClass.OnExecute]
All but the last colon are replaced (and even then, if that makes it overly complicated, the last .
can also be replaced).
Failed Attempts
I have been playing around with some regex to try and get this, but I am not familiar enough with it.
This doesn't work at all:
(([A-Z])\.)+
This also doesn't find anything:
\[(([A-Z])\.)+\]
I'm probably way off base. I haven't used regex enough to be familiar enough to know how to use the find and replace with regex.