Results 1 to 2 of 2
  1. #1

    Question Matching key/value pairs

    Hi,

    I have a large text file with lots of "key : value" entries. These entries are nested to form a tree of sorts. Nesting is achieved through different indentation levels. (So sorting is out.)

    I would like to use some of these key/value pairs to realign the comparison between files. Is there anyway I can configure the rules in BC3 to do this? Basically I want to say for "this key", explicitly match values that follow on the same line and give priority to matching these lines first.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    7,609

    Default

    Hello,

    We can give priority by adding a line weight to a specific regular expression match ("Key"), but it would not take the indentation into account unless that was also defined as part of the regular expression. Line weights are defined in the Tools menu -> File Format, as part of the file format in the grammar tab.

    Depending on your data, it may be easier to pre-process it with your own custom tidying process, so that it is sorted and the matches would more likely align automatically.
    http://www.scootersoftware.com/suppo...rnalconversion

    You can also try different Alignment options, such as Alternate Alignment in the Text Compare's Session Setting dialog's Alignment tab. Another trick may be to define a Grammar element for the Key, then mark it as Important and Everything Else as Unimportant. Then change the Alignment settings to "Never Align Mismatches", which would then only align based on the defined Important grammar when it matches exactly.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •