Announcement

Collapse
No announcement yet.

Identify matching procedure headers

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

  • Identify matching procedure headers

    Having spent a good few hours at this the time has come to ask for help!

    I am trying to compare pairs of source files containing VB6 code and would like to pull out JUST the procedure headers that match in order to produce some documentation.

    What I've tried to do so far is to make a 'Replacement' on one side of any line that does NOT include 'Sub', 'Property' or 'Function' with some random text to force a mismatch on any line that isn't a procedure header and then filter with the 'Show Same' button to copy and paste the results. However, the slight flaw in my plan is that I have not been able to find a way of identifying such lines!

    Can anybody tell me how to construct a regular expression that identifies lines that do NOT contain the above mentioned keywords?

    Or am I just going about it in completely the wrong way?

    Thank you in advance for your help.

  • #2
    Hello David,

    Instead of using Replacements, you would want to define general Important and Unimportance using this walk-through:
    http://www.scootersoftware.com/suppo..._unimportantv3

    Once you define a grammar for these lines or the entire header, you can mark the whole section as either Important or Unimportant. What do you mean by "pull out"? You wish to compare only the header or disregard it?

    If Compare only the header, you would make a grammar definition for the header and then mark "Everything Else" as unimportant. If to disregard it, make the definition, then mark that definition as Unimportant.

    Lastly, use the Ignore Unimportant Differences toggle to show any blue text as black (equal) text, removing it as a difference and treating it as equal.

    Does that help clear things up?
    Aaron P Scooter Software

    Comment


    • #3
      Aaron,

      Thank you very much for you're quick reply. Having spent a couple more hours this morning at it I think I'm trying to stretch Beyond Compare too far. I realise that I've misunderstood what Replacements do.

      I think what I'm really needing is a filter that can further reduce the toggle switches 'Show Differences' or 'Show Same' to lines that match a given criteria, I guess analogous to the 'File filters' in a folder comparison working in conjunction with the various 'Show' toggles there.

      Just in case there I'm missing something obvious I'll have another go at explaining my problem using an example (very simplified!!!!):

      If file 1 contains:

      Sub MyProcedureHeader()
      debug.print "Hello World"
      End Sub

      and file 2 contains:

      Sub MyProcedureHeader()
      debug.print "Hello World"
      End Sub

      Sub MyOtherProcedureHeader()
      debug.print "Hello Other World"
      End Sub

      The only lines I want to see in the left/right panes (so that I can then cut and paste into my document) are lines that are identical AND contain the word Sub ie. the line 'Sub MyProcedureHeader()' in the example above.

      At the moment I can acheive what I want by turning on 'Show Same', copying all the lines into another file and then further filter using grep/excel etc... Its just a bit tedious as I'm having to do it a lot so I was hoping for a one-pass solution.

      Any more ideas gratefully received but I had better press on regardless...!

      David

      Comment


      • #4
        Hello David,

        Yes, the replacements and grammar items are designed to help show or hide specific difference detections, and not to match and show only specific text itself.

        Your current method is the best workflow at this time. Use the Display Filters to show only equal text, and then search for Sub to find each instance of equal Sub lines.
        Aaron P Scooter Software

        Comment


        • #5
          You want want to look at powergrep.

          Comment

          Working...
          X