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

Re: [Clip] How to make the clip?

Expand Messages
  • Axel Berger
    ... This is not elegant and cobbled together from stuff in my clipbar. You should have set the line length in the editor to your preferred size before running
    Message 1 of 8 , Dec 8, 2012
    • 0 Attachment
      puusto13 wrote:
      > Can somebody help me and make me the clip.

      This is not elegant and cobbled together from stuff in my clipbar. You
      should have set the line length in the editor to your preferred size
      before running it.
      Split lines gets rid of the space at the end of lines not ending
      paragraphs, which is usually the opposite of what I want. The next
      commands rectify it. The blank lines are needed to mark the difference
      between paragraph- and line-ends and can be got rid of in the end.


      ^!Replace "^(\d+)\. " >> "\n$1\. " WRASTI
      ^!Replace "^Psalmi (\d+)" >> "\nPsalmi $1" WRASTI
      ^!Select ALL
      ^!Menu Modify/Lines/Join Lines
      ^!Menu Modify/Lines/Split Lines
      ^!Replace "^P" >> " ^P" HASTI
      ^!Replace " ^P ^P" >> "^P^P" HASTI
      ^!Replace " +\R\R" >> "\n\n" HRASTI
      ^!Replace "^P^P" >> "^P" HASTI

      There are lots of far more elegant alternatives e.g. using ^$StrSplit()$

      Axel
    • puusto13
      Hi, Thank You. This is what I want. Very good job:) TL
      Message 2 of 8 , Dec 8, 2012
      • 0 Attachment
        Hi,

        Thank You. This is what I want. Very good job:)

        TL

        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
        >
        > puusto13 wrote:
        > > Can somebody help me and make me the clip.
        >
        > This is not elegant and cobbled together from stuff in my clipbar. You
        > should have set the line length in the editor to your preferred size
        > before running it.
        > Split lines gets rid of the space at the end of lines not ending
        > paragraphs, which is usually the opposite of what I want. The next
        > commands rectify it. The blank lines are needed to mark the difference
        > between paragraph- and line-ends and can be got rid of in the end.
        >
        >
        > ^!Replace "^(\d+)\. " >> "\n$1\. " WRASTI
        > ^!Replace "^Psalmi (\d+)" >> "\nPsalmi $1" WRASTI
        > ^!Select ALL
        > ^!Menu Modify/Lines/Join Lines
        > ^!Menu Modify/Lines/Split Lines
        > ^!Replace "^P" >> " ^P" HASTI
        > ^!Replace " ^P ^P" >> "^P^P" HASTI
        > ^!Replace " +\R\R" >> "\n\n" HRASTI
        > ^!Replace "^P^P" >> "^P" HASTI
        >
        > There are lots of far more elegant alternatives e.g. using ^$StrSplit()$
        >
        > Axel
        >
      • flo.gehrke
        ... ...or just: ^!Replace R(?! d|Psalmi) WARS Regards, Flo
        Message 3 of 8 , Dec 8, 2012
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
          >
          > This is not elegant and cobbled together from stuff in my
          > clipbar. (..)
          >
          > ^!Replace "^(\d+)\. " >> "\n$1\. " WRASTI
          > ^!Replace "^Psalmi (\d+)" >> "\nPsalmi $1" WRASTI
          > ^!Select ALL
          > ^!Menu Modify/Lines/Join Lines
          > ^!Menu Modify/Lines/Split Lines
          > ^!Replace "^P" >> " ^P" HASTI
          > ^!Replace " ^P ^P" >> "^P^P" HASTI
          > ^!Replace " +\R\R" >> "\n\n" HRASTI
          > ^!Replace "^P^P" >> "^P" HASTI
          >
          > There are lots of far more elegant alternatives e.g.
          > using ^$StrSplit()$

          ...or just:

          ^!Replace "\R(?!\d|Psalmi)" >> "" WARS

          Regards,
          Flo
        • Don
          ... Brilliant! Find explanation R means any return character (?! means and NOT d means number ... Psalmi means literally that ... ) closes the alternate not
          Message 4 of 8 , Dec 8, 2012
          • 0 Attachment
            On 12/8/2012 11:04 PM, flo.gehrke wrote:
            > ...or just:
            >
            > ^!Replace "\R(?!\d|Psalmi)" >> "" WARS
            >
            > Regards,
            > Flo
            >

            Brilliant!
            Find explanation
            \R means any return character
            (?! means and NOT
            \d means number
            | means or
            Psalmi means literally that ...
            ) closes the alternate not choices.

            Replace with nothing ""

            W = whole document
            A = all
            R = ReGex
            S = silent

            so remove all return characters that are not followed immediately by a
            number or the word Psalmi.
          • Axel Berger
            ... Not quite. That neither adds a space to lines nor deletes it from paragraphs. If you re already satisfied with what Split Lines does, you can stop right
            Message 5 of 8 , Dec 9, 2012
            • 0 Attachment
              "flo.gehrke" wrote:
              > ^!Replace "\R(?!\d|Psalmi)" >> "" WARS

              Not quite. That neither adds a space to lines nor deletes it from
              paragraphs. If you're already satisfied with what Split Lines does, you
              can stop right there.

              Part of that clip is very old and comes from a time when I avoided
              Regex. Thus the possibility of more than one space at lines' ends was
              dealt with through:

              ^!Replace " ^P ^P" >> "^P^P" HASTI
              ^!Replace " ^P^P" >> "^P^P" HASTI
              ^!Replace " ^P^P" >> "^P^P" HASTI

              I wouldn't write it like that any more and rather use a one-line Regex,
              but why change what works?

              Apart from that you're right in that your suggestion does not get rid of
              all double newlines but specificlly those added above.
            • Axel Berger
              ... If you meant the whole solution without Join Lines, then it doesn t work. The example as copied from the mail has no spaces in front of the unwanted
              Message 6 of 8 , Dec 9, 2012
              • 0 Attachment
                "flo.gehrke" wrote:
                > ^!Replace "\R(?!\d|Psalmi)" >> "" WARS

                If you meant the whole solution without Join Lines, then it doesn't
                work. The example as copied from the mail has no spaces in front of the
                unwanted newlines. Just deleting them will join two words. But looking
                closer

                ^!Replace "\R(?!\d|Psalmi)" >> " " WARS

                should work and indeed do the trick in one single one-liner, provided
                word wrapped long lines are accepted where I provided hard wrapped ones.

                Axel
              • flo.gehrke
                ... Thanks for correcting this! I can t see, however, that puusto13 asked for word-wrap, empty lines etc. For me, the guiding principle is what we see from the
                Message 7 of 8 , Dec 9, 2012
                • 0 Attachment
                  --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                  >
                  > Just deleting them will join two words. But looking closer
                  >
                  > ^!Replace "\R(?!\d|Psalmi)" >> " " WARS
                  >
                  > should work and indeed do the trick in one single one-liner,
                  > provided word wrapped long lines are accepted where I provided hard
                  > wrapped ones

                  Thanks for correcting this!

                  I can't see, however, that puusto13 asked for word-wrap, empty lines etc. For me, the guiding principle is what we see from the data "before & after" that were posted.

                  Regards,
                  Flo
                • Axel Berger
                  ... Absolutely. However in a mail lines are usually hard-wrapped, whether intended or not. My main reason, to be honest, was though, that I adapted an earlier
                  Message 8 of 8 , Dec 9, 2012
                  • 0 Attachment
                    "flo.gehrke" wrote:
                    > For me, the guiding principle is what we see from the data
                    > "before & after" that were posted.

                    Absolutely. However in a mail lines are usually hard-wrapped, whether
                    intended or not. My main reason, to be honest, was though, that I
                    adapted an earlier solution where wrapping the result was required.

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