Notepad3
Notepad3 copied to clipboard
Registry files Value Names issue if start with { and of length = 38
Hi, I came across an issue with registry files. The issue is that value names are colored green (like comments or strings) if they start with a { and are of a specific length of 38 characters. I'm using Notepad3 x64 v5.21.1129.1. It's better explained using screenshots. I use the default styling and colors for the Registry scheme with the exception of "Value Name" which I set to bright blue for better visibility in my screenshots.

The first screenshot above shows two registry values, FPS-NB_Session-In-TCP and {4B4B9675-9984-4471-851A-060BE9F5C2EB} The first value is colored in blue as it should as per the default colors of the Registry scheme. The second one is colored in green when it should be blue like the first one. I found this only happens if the Value Name starts with the character { and the length of the value (including the { } characters) is exactly 38. I replaced { with [ and several other characters to test it out and the Value immediately turns blue. Similarly, if I add any character to {4B4B9675-9984-4471-851A-060BE9F5C2EB} or delete any character from it, The Value immediately turns blue as well.
My first screenshot is based on a real functional registry file I have. My second screenshot is a .reg file with fictional entries which doesn't have any functionality but it simplifies the test case to the bare minimum. Here we clearly see the first entry "test" as well as the other entries of length different than 38 are colored blue as they should, but the one of length 38 is colored green.

Wow, yes this is even weirder than I thought, there's definitely something going on. (I also realize should have initially attached my own Test.reg file instead of posting screenshots... I didn't know if we were allowed to.)
I also realize should have initially attached my own Test.reg file instead of posting screenshots... I didn't know if we were allowed to.
The following extensions are accepted:
- PNG (.png)
- GIF (.gif)
- JPEG (.jpg)
- Log files (.log)
- Microsoft Word (.docx), Powerpoint (.pptx), and Excel (.xlsx) documents
- Text files (.txt)
- PDFs (.pdf)
- ZIP (.zip, .gz)
- Video (.mp4, .mov)
Hello @leyabe ,
A valid Key (correctly formated) of this type {4B4B9675-9984-4471-851A-060BE9F5C2EB} has a length of 38 ! 👍
This issue is that "String" is colored in "green" and "Comment" is also colored in "green"! If you change the color of "String" to (for example) "magenta", there is no more problem. 👍
In zip file: Test.reg
[Registry Files]
String=fore:#B000B0

I will suggest to @RaiKoHoff to modify the color of "String". 🤔
@hpwamr Thanks. I'm not sure that's the whole explanation though. My understanding is that String is what comes after the equal sign. What comes before is "Value Name". This can be seen in the first line of my new screenshot below i.e. the string after the equal sign for changed to Magenta (in addition to some of the 38-length Value Names which are now also Magenta).
A valid Key (correctly formated) of this type
{4B4B9675-9984-4471-851A-060BE9F5C2EB}has a length of 38 !
I'm not sure that's the whole explanation though. My understanding is that String is what comes after the equal sign.
No so simple because {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7} can be either a "Key", or a "Value" or a "Data" ! 🤔

The Registry-File Lexer has a very simple GUID parser to distinguish between valid GUID and not valid GUID - maybe this can be enhanced, but this would be an Lexilla Upstream issue.
