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

stripping links=> clippable

Expand Messages
  • Mike Breiding
    Greetings, Is there a clip to strip the anchors/links from a doc or highlighted section? Example: Before: Link-Name After:
    Message 1 of 8 , Aug 12, 2008
    • 0 Attachment
      Greetings,

      Is there a clip to strip the anchors/links from a doc or highlighted
      section?

      Example:
      Before: <a href="http://www.xxx.xxx/">Link-Name</a>
      After: Link-Name

      Thanks,
      -Mike
    • John Shotsky
      This is one way to do it: ^!Replace $1 ARSTW Before: Link-Name After: Link-Name You
      Message 2 of 8 , Aug 12, 2008
      • 0 Attachment
        This is one way to do it:

        ^!Replace "<a href=\"https?:.+>(.+)<\/a>\>" >> "$1" ARSTW

        Before:
        <a href="http://www.xxx.xxx/">Link-Name</a>
        After:
        Link-Name

        You can either add this as a clip, or use it in the find/replace dialog. It works on the whole doc. (W)

        John

        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Mike Breiding
        Sent: Tuesday, August 12, 2008 4:30 AM
        To: NoteTab Clips
        Subject: [Clip] stripping links=> clippable


        Greetings,

        Is there a clip to strip the anchors/links from a doc or highlighted
        section?

        Example:
        Before: <a href="http://www.xxx.xxx/">Link-Name</a>
        After: Link-Name

        Thanks,
        -Mike



        [Non-text portions of this message have been removed]
      • Mike Breiding
        ... Hi John, I ran the clip on this html and nothing happened: Tu
        Message 3 of 8 , Aug 12, 2008
        • 0 Attachment
          John Shotsky wrote:
          > This is one way to do it:
          > ^!Replace "<a href=\"https?:.+>(.+)<\/a>\>" >> "$1" ARSTW
          >
          Hi John,
          I ran the clip on this html and nothing happened:
          <td width="12%"><a href="/wiki/Tuesday" title="Tuesday">Tu</a></td>
          <td width="12%"><a href="/wiki/Wednesday" title="Wednesday">We</a></td>
          <td width="12%"><a href="/wiki/Thursday" title="Thursday">Th</a></td>
          <td width="12%"><a href="/wiki/Friday" title="Friday">Fr</a></td>
          > You can either add this as a clip, or use it in the find/replace dialog. It works on the whole doc. (W)
          >
          I am not familiar with using clips in the find/replace dialog.
          I could not find anything in the help files.

          Thanks,
          -Mike
        • Axel Berger
          ... Not the whole clip, but the and as in ^!Replace WRAS Can be used in the dialogue as well. (Quotes in the clip, no
          Message 4 of 8 , Aug 12, 2008
          • 0 Attachment
            Mike Breiding wrote:
            > I am not familiar with using clips in the find/replace dialog.

            Not the whole clip, but the <Find> and <Replace> as in
            ^!Replace "<Find>" >> "<Replace>" WRAS
            Can be used in the dialogue as well. (Quotes in the clip, no quotes
            for the dialogue.)

            Try:
            ^!Replace "<a href=".+?>(.+?)</a>" >> "$1" WRAS

            John's clip was for external links begining with http(s)://

            Axel
          • Mike Breiding
            ... Thanks, Axel. That removed the internal links. John, I saved yours to a clip for future use. -Mike
            Message 5 of 8 , Aug 12, 2008
            • 0 Attachment
              Axel Berger wrote:
              > Try:
              > ^!Replace "<a href=".+?>(.+?)</a>" >> "$1" WRAS
              >
              > John's clip was for external links begining with http(s)://
              Thanks, Axel. That removed the internal links.
              John, I saved yours to a clip for future use.

              -Mike
            • John Shotsky
              Mike, Although I see Axel has already responded, you correctly state that the clip I wrote won t work on these lines, because I was expecting external links,
              Message 6 of 8 , Aug 12, 2008
              • 0 Attachment
                Mike,

                Although I see Axel has already responded, you correctly state that the clip I wrote won't work on these lines, because
                I was expecting external links, as in your original example. I have found that it pays to be very specific to prevent
                unwanted consequences, the hard way. My clips typically run on thousands of lines of text, and it really takes
                discipline to write clips that will get every case you care about, but not more. So Axel's clip should do what you want,
                but do review the result for unintended consequences.

                The find and replace dialog is a most useful tool. Open it, click the regex and case checkboxes, then have fun. I often
                build a clip in the Find section, as I did with the one above - Just keep adding elements to the find dialog to make it
                work the way you want, repeatedly hitting the 'Find' button to see all the cases it will find.

                Looking at your examples below, I wonder if you want everything on the line removed except the day abbreviation. If so,
                yet another clip will be required:

                ^!Replace "^.*>(.+)<\/a>.+" >> "$1" ARSTW

                Output:
                Tu
                We
                Th
                Fr

                John

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Mike Breiding
                Sent: Tuesday, August 12, 2008 5:13 AM
                To: ntb-clips@yahoogroups.com
                Subject: Re: [Clip] stripping links=> clippable

                John Shotsky wrote:
                > This is one way to do it:
                > ^!Replace "<a href=\"https?:.+>(.+)<\/a>\>" >> "$1" ARSTW
                >
                Hi John,
                I ran the clip on this html and nothing happened:
                <td width="12%"><a href="/wiki/Tuesday" title="Tuesday">Tu</a></td>
                <td width="12%"><a href="/wiki/Wednesday" title="Wednesday">We</a></td>
                <td width="12%"><a href="/wiki/Thursday" title="Thursday">Th</a></td>
                <td width="12%"><a href="/wiki/Friday" title="Friday">Fr</a></td>
                > You can either add this as a clip, or use it in the find/replace dialog. It works on the whole doc. (W)
                >
                I am not familiar with using clips in the find/replace dialog.
                I could not find anything in the help files.

                Thanks,
                -Mike



                [Non-text portions of this message have been removed]
              • Mike Breiding
                ... Hi John, Thanks for fleshing this out. My apologies for sending you an example (external links) that I was not using! What was I thinking? ... What I am
                Message 7 of 8 , Aug 12, 2008
                • 0 Attachment
                  John Shotsky wrote:
                  > Mike,
                  >
                  > Although I see Axel has already responded, you correctly state that the clip I wrote won't work on these lines, because
                  > I was expecting external links, as in your original example. I have found that it pays to be very specific to prevent
                  > unwanted consequences, the hard way. My clips typically run on thousands of lines of text, and it really takes
                  > discipline to write clips that will get every case you care about, but not more. So Axel's clip should do what you want,
                  > but do review the result for unintended consequences.
                  >
                  Hi John,
                  Thanks for fleshing this out.
                  My apologies for sending you an example (external links) that I was not
                  using!
                  "What was I thinking?"
                  >
                  > The find and replace dialog is a most useful tool. Open it, click the regex and case checkboxes, then have fun. I often
                  > build a clip in the Find section, as I did with the one above - Just keep adding elements to the find dialog to make it
                  > work the way you want, repeatedly hitting the 'Find' button to see all the cases it will find.
                  >
                  > Looking at your examples below, I wonder if you want everything on the line removed except the day abbreviation. If so,
                  > yet another clip will be required:
                  >
                  > ^!Replace "^.*>(.+)<\/a>.+" >> "$1" ARSTW
                  >
                  >
                  What I am doing is using calendars from WikiPedia for my own purpose.
                  What I wanted to do is strip their targets and replace them with mine.
                  Here are the examples.
                  WikiPedia Calendar: http://en.wikipedia.org/wiki/June_1977#June
                  My version:
                  http://epicroadtrips.us/dad/journals/travel/usa/central_states_north_trip_june_2-15_1977/central-states-north_trip_june_2-15_1977.php

                  Thanks again,
                  -Mike


                  > Output:
                  > Tu
                  > We
                  > Th
                  > Fr
                  >
                  > John
                  >
                • Axel Berger
                  ... I wholeheartedly agree. The problem here is that you usually know the specific details of what you re working with in your own material, but it s hard to
                  Message 8 of 8 , Aug 12, 2008
                  • 0 Attachment
                    John Shotsky wrote:
                    > I have found that it pays to be very specific to prevent
                    > unwanted consequences, the hard way.

                    I wholeheartedly agree. The problem here is that you usually know the
                    specific details of what you're working with in your own material, but
                    it's hard to guess in the group. But then everyone ought to treat
                    suggestions given here with due caution anyway, I hope.

                    > but do review the result for unintended consequences.

                    Please do! Just for one example internal links to #top or whatever will
                    be deleted to with my clip.

                    Axel
                  Your message has been successfully submitted and would be delivered to recipients shortly.