Tapatalk

Highlighting of registry keys with square brackets inside in Windows *.reg files

Highlighting of registry keys with square brackets inside in Windows *.reg files

2
NewbieNewbie
2

    Apr 16, 2019#1

    I am using UEStudio v19 to edit Windows registry files and use the following wordfile to highlight text.

    Code: Select all

    /L6"Reg Files" DisableMLS Nocase Line Comment = ; String Chars = "'% Escape Char = \ File Extensions = REG
    /Delimiters = ! " %&'()*+,-./:;<=>?@[\]^{|}~
    /Function String = "%^[^(*^)^]$"
    /Marker Characters = "[]"
    /C1"Header"
    []
    /C2"Equal Sign"
    ,
    -
    =
    This wordfile works great in most situations and properly highlights registry key headers such as: [HKEY_CURRENT_USER\Software\Testing]

    The problem occurs when the header contains brackets of it's own. In this situation the highlighting ends at the first occurrence of closing bracket: [HKEY_CURRENT_USER\Software\Testing [Nested] Brackets]

    Do I miss a setting in the wordfile that will fix this, or is this a limitation of the product?
    -Eric S.

    6,685587
    Grand MasterGrand Master
    6,685587

      Apr 16, 2019#2

      Here is the wordfile used by me for syntax highlighting Windows registry files which is better than the one posted by you in my opinion.

      Code: Select all

      /L20"Registry" String Chars = " Escape Char = \ DisableMLS File Extensions = REG
      /Delimiters = " (),:=[]
      /Open Brace Strings = "(" "["
      /Close Brace Strings = ")" "]"
      /Open Fold Strings = "["
      /Close Fold Strings = "["
      /Ignore Fold Strings = "="
      /Marker Characters = "[]"
      /C1"Header"
      Editor
      REGEDIT4 Registry
      Version
      Windows
      /C2"Default Value"
      @
      /C3"Separators"
      (
      )
      ,
      :
      = =dword =hex
      [
      \
      ]
      /C4"Registry Keys"
      []
      
      But it uses also a Marker Characters definition to syntax highlight everything between [ and next ] on same line with the settings defined for color group four with name Registry Keys.

      I read the Microsoft documentations Structure of the Registry and Registry Value Types and it is indeed possible to use square brackets in a key name. But I have never seen a registry key with square brackets in over 20 years with having seen millions of lines in registry files.

      Only block comment and alternate block comment syntax highlighting supports highlighting everything between [ and matching ] on same or any line below.

      Here is my wordfile adapted to support syntax highlighting of keys with square brackets in a key name:

      Code: Select all

      /L20"Registry" String Chars = " Escape Char = \ DisableMLS NestBlockComments Block Comment On Alt = [ Block Comment Off Alt = ] File Extensions = REG
      /Delimiters = " (),:=[]
      /Open Brace Strings = "(" "["
      /Close Brace Strings = ")" "]"
      /Open Fold Strings = "["
      /Close Fold Strings = "["
      /C1"Header"
      Editor
      REGEDIT4 Registry
      Version
      Windows
      /C2"Default Value"
      @
      /C3"Separators"
      (
      )
      ,
      :
      = =dword =hex
      [
      \
      ]
      
      The registry keys are syntax highlighted with settings for Alternate Block Comments on using this variant of wordfile for *.reg files.

      It is also possible to use the settings for Comments by replacing in first line of the wordfile above Block Comment On Alt = [ Block Comment Off Alt = ] by Block Comment On = [ Block Comment Off = ].
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Apr 16, 2019#3

        Thank you that did the trick. I have never stumbled across this either until this morning, and looked at this as an opportunity to learn a little more about wordfiles.
        -Eric S.