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

Need Reg Exp

Expand Messages
  • Mike Hopkins
    I have a book saved in .txt format. It will be about 150 pages when printed. My problem is that each line of the book has a hard coded EOL. There are also
    Message 1 of 5 , Jun 1, 2005
    • 0 Attachment
      I have a book saved in ".txt" format. It will be about 150 pages when
      printed.

      My problem is that each line of the book has a hard coded EOL. There are
      also EOL characters between sections, after headers, etc.

      The EOL characters at the end of lines within paragraphs need to be removed
      so I can print the book without choppy lines of copy.

      The first line of each paragraph of straight text has three spaces of
      indentation.

      How can I remove the EOL characters which are NOT followed by three spaces
      without removing the rest?

      IF ( <EOL> AND NOT <EOL + ^Sp^Sp^Sp> ) THEN set EOL == <^Sp>;

      Thanks, Folks

      Mike Hopkins
      ironmike (AT) inav.net
    • Jody
      Hi Mike, Don t have Reg Exp ;) H=Join Non-Paragraphs ; eMailed on 06-01-2005, ntb-OffTopic@yahoogroups.com, Jody ;
      Message 2 of 5 , Jun 1, 2005
      • 0 Attachment
        Hi Mike,

        Don't have Reg Exp ;)

        <--- Copy below this line --->
        H=Join Non-Paragraphs
        ; eMailed on 06-01-2005, ntb-OffTopic@yahoogroups.com, Jody
        ; http://www.fookes.us http://www.sojourner.us/software)
        ; notetab.net, clean-funnies.com, fookes.us, sojourner.us

        ; This assumes you do not have like lists in the
        ; paragraphs that you do not want joined like
        ; 1. This assumes...
        ; 2. This assumes...
        ; 3. This assumes...
        ; You could use ^!Skip and stop at every selection and
        ; only join the paragraphs you see are OK to join.

        ^!SetHintInfo Working...
        ^!SetScreenUpdate Off

        :Loop
        ^!Find "^p " S
        ^!IfError End
        ^!Jump Select_End
        ^!Set %Start%=^$GetRow$:^$GetCol$
        ^!Find "^p " S
        ^!Jump Select_Start
        ^!SelectTo ^%Start%
        ^!Replace "^p" >> " " HAS
        ^!Goto Loop

        <--- Copy above this line --->
        <--- Right click over a Library --->
        <--- Choose: Add from Clipboard --->


        >I have a book saved in ".txt" format. It will be about 150 pages when
        >printed.
        >
        >My problem is that each line of the book has a hard coded EOL. There are
        >also EOL characters between sections, after headers, etc.
        >
        >The EOL characters at the end of lines within paragraphs need to be removed
        >so I can print the book without choppy lines of copy.
        >
        >The first line of each paragraph of straight text has three spaces of
        >indentation.
        >
        >How can I remove the EOL characters which are NOT followed by three spaces
        >without removing the rest?
        >
        > IF ( <EOL> AND NOT <EOL + ^Sp^Sp^Sp> ) THEN set EOL == <^Sp>;


        Happy Topics,
        Jody

        The NoteTab Off-Topic List
        mailto:ntb-OffTopic-Subscribe@yahoogroups.com
        mailto:ntb-OffTopic-UnSubscribe@yahoogroups.com

        All Fookes Software mailing lists and more...
        http://www.fookes.us/maillist.htm
        http://www.fookes.us/redir http://www.clean-funnies.com/
        http://www.notetab.net/ http://www.sojourner.us/software
      • Hugo Paulissen
        ... spaces ... ; ... Mike, You could try it with n{[^ s][^ s][^ s]} in the find box and n 1 in the replace box Test it first with a copy of your file, I
        Message 3 of 5 , Jun 1, 2005
        • 0 Attachment
          >
          > How can I remove the EOL characters which are NOT followed by three
          spaces
          > without removing the rest?
          >
          > IF ( <EOL> AND NOT <EOL + ^Sp^Sp^Sp> ) THEN set EOL ==
          <^Sp>;
          >
          > Thanks, Folks
          >
          > Mike Hopkins
          > ironmike (AT) inav.net

          Mike,

          You could try it with

          \n{[^\s][^\s][^\s]} in the find box

          and

          \n\1 in the replace box

          Test it first with a copy of your file, I only tested it on a a
          couiple of lines...

          Explanation:
          \n = newline

          {everything in brackets} = restored by inserting \1 in the replace box

          [^\s] = any character but no space

          Hugo
        • Jody
          Hi Mike, ... You can also do it with ^!Toolbar Join Lines instead of the ^!Replace below. Clips are normally much faster than RegExp, even though they take
          Message 4 of 5 , Jun 1, 2005
          • 0 Attachment
            Hi Mike,

            >The first line of each paragraph of straight text has three
            >spaces of indentation.
            >
            >How can I remove the EOL characters which are NOT followed by
            >three spaces without removing the rest?

            You can also do it with ^!Toolbar Join Lines instead of the
            ^!Replace below. Clips are normally much faster than RegExp, even
            though they take longer to write. In the one below though I just
            click on a button on my Tools Clipbar and it inserts the
            following into the document, so it is a matter of just typing in
            a few things.

            My "template" in which the cursor ends up in the first ^!Find
            between the quotes:

            :Loop
            ^!Find "CURSOR IS HERE" S
            ^!IfError End
            ^!Jump Select_
            ^!Set %Start%=^$GetRow$:^$GetCol$
            ^!Find "" S
            ^!Jump Select_
            ^!SelectTo ^%Start%
            ^!Goto Loop


            H=Join Non-Paragraphs
            ; Using Join Lines instead of Replace
            ; Optional Skip
            ^!SetHintInfo Working...
            ^!SetScreenUpdate Off
            :Loop
            ^!Find "^p " S
            ^!IfError End
            ^!Jump Select_End
            ^!Set %Start%=^$GetRow$:^$GetCol$
            ^!Find "^p " S
            ^!Jump Select_Start
            ^!SelectTo ^%Start%
            ; ^!Skip Skip this joining the lines of this selection?
            ^!Toolbar Join Lines
            ; ^!Replace "^p" >> " " SAH
            ^!Goto Loop


            Happy Clip'n!
            Jody

            All Lists: http://www.fookes.us/maillist.htm
            Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
            UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
            Options: http://groups.yahoo.com/group/ntb-clips
            http://www.clean-funnies.com, http://www.sojourner.us/software
          • Mike Hopkins
            ... Thanks, Jody. I will try this tomorrow when I get home from (night shift) work. Mike
            Message 5 of 5 , Jun 1, 2005
            • 0 Attachment
              > >How can I remove the EOL characters which are NOT followed by
              > >three spaces without removing the rest?
              >
              > You can also do it with ^!Toolbar Join Lines instead of the
              > ^!Replace below. Clips are normally much faster than RegExp, even
              > though they take longer to write. In the one below though I just
              > click on a button on my Tools Clipbar and it inserts the
              > following into the document, so it is a matter of just typing in
              > a few things.
              >
              > My "template" in which the cursor ends up in the first ^!Find
              > between the quotes:
              >
              > :Loop
              > ^!Find "CURSOR IS HERE" S
              > ^!IfError End
              > ^!Jump Select_
              > ^!Set %Start%=^$GetRow$:^$GetCol$
              > ^!Find "" S
              > ^!Jump Select_
              > ^!SelectTo ^%Start%
              > ^!Goto Loop
              >
              >
              > H=Join Non-Paragraphs
              > ; Using Join Lines instead of Replace
              > ; Optional Skip
              > ^!SetHintInfo Working...
              > ^!SetScreenUpdate Off
              > :Loop
              > ^!Find "^p " S
              > ^!IfError End
              > ^!Jump Select_End
              > ^!Set %Start%=^$GetRow$:^$GetCol$
              > ^!Find "^p " S
              > ^!Jump Select_Start
              > ^!SelectTo ^%Start%
              > ; ^!Skip Skip this joining the lines of this selection?
              > ^!Toolbar Join Lines
              > ; ^!Replace "^p" >> " " SAH
              > ^!Goto Loop


              Thanks, Jody. I will try this tomorrow when I get home from (night shift)
              work.

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