Announcement

Collapse
No announcement yet.

Second matched unimportant text in a line is ignored

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Second matched unimportant text in a line is ignored

    I have two html files contain these lines:
    file1
    Code:
    <p class="inclass5">"Do you <i class="inclass6">ever</i> do what you're told?"</p>
    file2
    Code:
    <p class="inclass7">"Do you <i class="inclass8">ever</i> do what you're told?"</p>
    I added this grammar item and marked it unimportant: (I've tried moving it to the top of the grammar list too)
    Code:
    class="inclass\d+"
    And this is the result:



    Is there a way to make these lines unimportant difference? It works when I add a replacement item for "inclass6" & "inclass8" but there are more html files with different inclass numbers and changing it everytime is not ideal.

  • #2
    Hello,

    Defining a grammar item to match:
    inclass\d
    (regular expression)
    should work, unless another grammar element is overriding it. The order of the list is important, and moving it to the top will help, but if another grammar element starts sufficiently before it can still override the new definition. If you click your cursor into the text area (between the s and 6), the bottom status bar will display the currently detected grammar. If it is String, for example, you can stretch your current definition to include the " characters.

    If you are still having any trouble, would it be possible to get an email to [email protected] including:
    -You current Support.zip from the Help menu -> Support; Export
    - A pair of sample files (or, if applicable, we can just use the above line pair)
    - A link back to this forum post for our reference.

    Thanks. With these items, we'll be able to reproduce your setup and help configure it to ignore this text. Let us know if you have any questions.
    Aaron P Scooter Software

    Comment


    • #3
      Thanks for the tip about the currently detected grammar. My problem is solved easily by deleting these grammar items:
      Code:
      String=Text from " to "
      String=Text from ' to '
      Last edited by grandwale; 04-Jan-2012, 02:12 AM.

      Comment


      • #4
        Glad to hear it is working for you now.

        Alternatively, instead of deleting the string definitions, you can also make your new grammar include the quotes (so, it begins and ends at the same points as well). If it does this, and the grammar element is higher in the element list in the File Formats dialog, it should detect over String but still allow strings to be detected elsewhere.
        Aaron P Scooter Software

        Comment


        • #5
          As you've suggested, I've found another solution without deleting the string grammar items. I changed them to:
          Code:
          String=Text from =\s*" to "
          String=Text from =\s*' to '

          Comment


          • #6
            Excellent. BC3 grammar items are very customizable. Another option would be to leave strings as " to ", and making the other defintion set as "inclass6" (including the quotes). As long as the "inclass6" grammar is higher in the list, it should override the more general " to " string grammar.
            Aaron P Scooter Software

            Comment


            • #7
              Grammar rule clarification

              Hi,

              I am trying to get to grip with the grammar rules used within Beyond Compare 3.2.

              I have a line in a .txt document that includes a time stamp which are different between files. The line looks like:

              Run at 04/05/12 21:21 User svcsumucmuc Database REPORTV52 Version 5.2.1-SSA

              What grammar rule would I use to exclude any line beginning with (or containing) "Run at"? This line would then be unimportant when a file comparison report was created.

              Thanks,

              Steve

              Comment


              • #8
                Hello Steve,

                This KB article and video would probably be useful for you:
                http://www.scootersoftware.com/suppo..._unimportantv3

                For any line with "Run at", you can use a Regular Expression similar to:
                .*Run at.*
                with "Regular Expression" enabled. As a "Basic" grammar type.
                Aaron P Scooter Software

                Comment


                • #9
                  Thanks

                  Aaron,

                  Many thanks for your prompt reply. I will look into this as you suggested.

                  Thanks,

                  Steve

                  Comment

                  Working...
                  X