Loading ...
Sorry, an error occurred while loading the content.

RE: [Clip] regex clip to remove lines not containing

Expand Messages
  • John Shotsky
    I don t understand the request. ^ d.* matches every line that starts with a number. I can t see from the data which three lines are wanted, because two
    Message 1 of 8 , Sep 9 8:24 PM
    • 0 Attachment
      I don't understand the request.
      "^ \d.*" matches every line that starts with a number. I can't see from the data which three lines are wanted, because two lines are
      for one player, but any third line is for another player.

      If you want to keep every line that starts with a number, that's easy, but I don't think that's what you're after.

      Can you state the problem again?

      John

      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Don - HtmlFixIt.com
      Sent: Tuesday, September 09, 2008 7:37 PM
      To: ntb-clips@yahoogroups.com
      Subject: [Clip] regex clip to remove lines not containing

      Data looks like this:
      Linden Finish Position - 1

      Team Score (places): 56 Team Score (times): 1:24:05 Average
      Time: 16:49

      Overall Cum.
      Cum. Time
      Place Bib No Name Place Place Time
      Time Back
      1 261 Jake Hord 2 2
      16:16 16:16 00:00
      2 263 Brendan Sage 7 9
      16:44 33:00 00:27
      3 262 Kyle Lemieux 8 17
      16:47 49:48 00:30

      It repeats many times.

      I want to keep the last three lines and delete all other lines.

      This regex will match those lines.

      "^ \d.*"

      So how do I delete all but those lines?

      Currently I do it with a highlight line, find?, delete on error.



      [Non-text portions of this message have been removed]
    • Don - HtmlFixIt.com
      ... John, I think that the data got wrapped in transmission. I want to keep lines that start with four spaces and then a number. There were only three such
      Message 2 of 8 , Sep 9 8:59 PM
      • 0 Attachment
        John Shotsky wrote:
        > I don't understand the request.
        > "^ \d.*" matches every line that starts with a number. I can't see from the data which three lines are wanted, because two lines are
        > for one player, but any third line is for another player.
        >
        > If you want to keep every line that starts with a number, that's easy, but I don't think that's what you're after.
        >
        John, I think that the data got wrapped in transmission. I want to keep
        lines that start with four spaces and then a number. There were only
        three such lines when the data went out, but it wrapped the lines half
        way for you.
      • John Shotsky
        I see. Looks like this would work: ^!Replace ^ s*[A-Z.* R ARSTW That will delete any whole line that starts with a capital letter or spaces before a
        Message 3 of 8 , Sep 9 9:22 PM
        • 0 Attachment
          I see.

          Looks like this would work:
          ^!Replace "^\s*[A-Z.*\R" >> "" ARSTW

          That will delete any whole line that starts with a capital letter or spaces before a capital letter. What remains is the three lines
          that start with numbers or spaces before numbers.

          John

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Don - HtmlFixIt.com
          Sent: Tuesday, September 09, 2008 8:59 PM
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] regex clip to remove lines not containing

          John Shotsky wrote:
          > I don't understand the request.
          > "^ \d.*" matches every line that starts with a number. I can't see from the data which three lines are wanted, because two lines
          are
          > for one player, but any third line is for another player.
          >
          > If you want to keep every line that starts with a number, that's easy, but I don't think that's what you're after.
          >
          John, I think that the data got wrapped in transmission. I want to keep
          lines that start with four spaces and then a number. There were only
          three such lines when the data went out, but it wrapped the lines half
          way for you.



          [Non-text portions of this message have been removed]
        • John Shotsky
          Oops, left out a bracket..sheesh. ^!Replace ^ s*[A-Z].* R ARSTW From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of John
          Message 4 of 8 , Sep 9 9:32 PM
          • 0 Attachment
            Oops, left out a bracket..sheesh.
            ^!Replace "^\s*[A-Z].*\R" >> "" ARSTW

            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of John Shotsky
            Sent: Tuesday, September 09, 2008 9:22 PM
            To: ntb-clips@yahoogroups.com
            Subject: RE: [Clip] regex clip to remove lines not containing

            I see.

            Looks like this would work:
            ^!Replace "^\s*[A-Z.*\R" >> "" ARSTW

            That will delete any whole line that starts with a capital letter or spaces before a capital letter. What remains is the three lines
            that start with numbers or spaces before numbers.

            John

            From: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> [mailto:ntb-clips@yahoogroups.com
            <mailto:ntb-clips%40yahoogroups.com> ] On Behalf Of Don - HtmlFixIt.com
            Sent: Tuesday, September 09, 2008 8:59 PM
            To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
            Subject: Re: [Clip] regex clip to remove lines not containing

            John Shotsky wrote:
            > I don't understand the request.
            > "^ \d.*" matches every line that starts with a number. I can't see from the data which three lines are wanted, because two lines
            are
            > for one player, but any third line is for another player.
            >
            > If you want to keep every line that starts with a number, that's easy, but I don't think that's what you're after.
            >
            John, I think that the data got wrapped in transmission. I want to keep
            lines that start with four spaces and then a number. There were only
            three such lines when the data went out, but it wrapped the lines half
            way for you.


            [Non-text portions of this message have been removed]



            [Non-text portions of this message have been removed]
          • Don - HtmlFixIt.com
            ... Yes John. That was what I was trying to do. I was trying to figure it out in reverse in my mind, I guess. I was trying to negate the regex I had. Not
            Message 5 of 8 , Sep 10 4:09 AM
            • 0 Attachment
              John Shotsky wrote:
              > Oops, left out a bracket..sheesh.
              > ^!Replace "^\s*[A-Z].*\R" >> "" ARSTW
              Yes John.

              That was what I was trying to do. I was trying to figure it out in
              reverse in my mind, I guess. I was trying to negate the regex I had.
              Not negate in reverse or something like that.

              Sheri, I was just playing with: ^!SetArray %Array%=^$GetReSubStrings$
              As a followup to your getdocmatchall suggestion. But I think John's
              solution is what I was after this time.

              Thanks both for the help.
            • Sheri
              ... Hi Don, I don t see a need for arrays or substrings. In fact, your pattern doesn t have any substrings. This is what I would have done (but I used five,
              Message 6 of 8 , Sep 10 7:15 AM
              • 0 Attachment
                Don - HtmlFixIt.com wrote:
                > John Shotsky wrote:
                >
                >> Oops, left out a bracket..sheesh.
                >> ^!Replace "^\s*[A-Z].*\R" >> "" ARSTW
                >>
                > Yes John.
                >
                > That was what I was trying to do. I was trying to figure it out in
                > reverse in my mind, I guess. I was trying to negate the regex I had.
                > Not negate in reverse or something like that.
                >
                > Sheri, I was just playing with: ^!SetArray %Array%=^$GetReSubStrings$
                > As a followup to your getdocmatchall suggestion. But I think John's
                > solution is what I was after this time.
                >
                >
                Hi Don,

                I don't see a need for arrays or substrings. In fact, your pattern
                doesn't have any substrings. This is what I would have done (but I used
                five, not four, spaces in front of \d.* to match your sample):

                ^!Select All
                ^!SetListDelimiter ^P
                ^$GetDocMatchAll("^ \d.*";0)$
                ;end of clip

                Regards,
                Sheri
              Your message has been successfully submitted and would be delivered to recipients shortly.