Comment until Blank line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kenlee
    New User
    • Apr 2009
    • 1

    Comment until Blank line

    I would like to be able to treat multiple lines as a comment starting with a line and ending on the first blank line after it. The files I am starting with were generated on Windows by regedit.exe using the exported to a file type of ” Win9x/NT4 Registrations Files(*.reg)”. The lines in question all end with the CrLf (0A0D)according to the hex view in Beyond Compare but if I look at them with another editor they appear to end only in Lf (0A).
    Here is an example of what the exported Registry file looks like:
    [HKEY_LOCAL_MACHINE\mykey\1]
    "Active"=dword:00000001
    "SubscriptionID"="{44977CCB-EB35-420A-9A13-14C298E3A91F}"

    [HKEY_LOCAL_MACHINE\mykey\2]

    I set up a file format an grammar items based on the exiting .txt format
    Element name of “comment”
    Category of “delimited”
    Text from ”^\ [HKEY_LOCAL_MACHINE\\mykey\1]$ “
    To “^\x0D\x0A”
    I’ve tried several different values for the “To” Text but they don’t seem to work. Note: the quotes are not used they are only to highlight the values typed. I know the from text is working because it is show as a comment as well as the rest of the file so it appear that my “To” text is the issue. Ideally I would like to search To something like “^$”

    What “To” value should I be using here?
  • Aaron
    Team Scooter
    • Oct 2007
    • 16026

    #2
    Hello,

    The To grammar element cannot match on a blank/empty line. It will need to match on some particular pattern. If Subscription is always the last line, it could match on "SubscriptionID=.*"

    Or, it could match on the first part of the next section "[", but this will also include [ as part of its definition, and not part of any subsequent definitions; so this is not ideal or recommended.
    Aaron P Scooter Software

    Comment

    • Michael Bulgrien
      Carpal Tunnel
      • Oct 2007
      • 1772

      #3
      Originally posted by Aaron
      The To grammar element cannot match on a blank/empty line.
      UltraEdit finds an empty line with this regular expression:

      ^$

      It would be nice if Beyond Compare did the same.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment

      • Michael Bulgrien
        Carpal Tunnel
        • Oct 2007
        • 1772

        #4
        Scooter team... Is there any reason why BC cannot be enhanced to recognize the ^$ regular expression?
        BC v4.0.7 build 19761
        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16026

          #5
          Hello Michael,

          Our grammar library does not currently support that statement, but I have added it to our Wishlist.
          Aaron P Scooter Software

          Comment

          Working...