I am trying to define a custom function list (functionList.xml in% appdata% / Notepad ++) to use it as a navigator for a long text file used as input to the software.
I managed to get it to work almost perfectly, although there is another problem that bothers me: I would like to return the class even if there is no function in it .
Firstly, this is an example of what my text file looks like (some of you may recognize the .inp file used for eQuest energy modeling software, but that doesn't matter):
$ ********************************************************* $ ** ** $ ** Electric & Fuel Meters ** $ ** ** $ ********************************************************* $ --------------------------------------------------------- $ Electric Meters $ --------------------------------------------------------- "EM1" = ELEC-METER TYPE = UTILITY .. $ --------------------------------------------------------- $ Fuel Meters $ --------------------------------------------------------- $ --------------------------------------------------------- $ Master Meters $ --------------------------------------------------------- "MASTER-METERS 1" = MASTER-METERS MSTR-ELEC-METER = "EM1" MSTR-FUEL-METER = "FM1" .. $ --------------------------------------------------------- $ Something else $ --------------------------------------------------------- "XXX" = blabla ..
Here is the current parser that I have:
<parser id="equest_full" displayName="eQuest Full Function List"> <classRange mainExpr="\$.*?\r\n\r\n.*?(?=\$)" displayMode="node" > <className> <nameExpr expr='\w(\w|-|/| (?! ))+'/> </className> <function mainExpr='^\".*?\" = [^ ]+' > <functionName> <funcNameExpr expr=".*"/> </functionName> </function> </classRange> <function mainExpr="\$.*?\r\n\r\n"> <functionName> <nameExpr expr="\w(\w|-|/| (?! ))+"/> </functionName> </function> </parser>
The following appears in the function list area: 
I would really like it if it could also display "Fuel Meters" in the list, even if it is empty. The reason for this is that I am going to use this as a navigation page, and therefore I need anchors for empty sections so that I can quickly get there and add material.
Is this possible in Notepad ++? Any help would be greatly appreciated.
Something I was thinking about: if I could write regular code there, in ClassRange> Function, I would do an IF statement. If found "^ \". *? \ "= [^] +", Then go to the rest of the parsing. Otherwise, return the position of the first line of the class. I do not know how to do this with RegEx or if it is possible.
Update: I think I found a way that could work, but I cannot figure out the correct regex. Basically, I think that the problem with my current parser is that when the class is empty, it still returns as a class and, therefore, will not be received later by a function outside the class. I need to find a way to change this:
<classRange mainExpr="\$.*?\r\n\r\n.*?(?=\$)" displayMode="node" >
He must not pick up the Fuel Meters class. Now he understands this:
$ --------------------------------------------------------- $ Fuel Meters $ ---------------------------------------------------------
until the next $ sign.
How can I modify the above regex to make sure that there is at least one character that is not \ n \ r or spaces?