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

Re: [Clip] RegExp For Formatting Paragraphs

Expand Messages
  • Larry Hamilton
    Have you looked under the Modify Menu? There is an option under the Lines submenu to Reformat lines to a specified length. It will split long lines. There are
    Message 1 of 6 , Jun 5, 2005
    • 0 Attachment
      Have you looked under the Modify Menu?

      There is an option under the Lines submenu to Reformat lines to a
      specified length. It will split long lines. There are also options to
      join and split lines.

      This should meet most needs unless you have something that is so mangled
      only a regex or a clip can fix it.

      The regex gurus should have an answer for you soon.

      Larry Hamilton
      Kairos Computer Solutions
      http://www.kairoscomputers.com/
      Sales Affiliate for Grisoft Anti-Virus

      acantley5 wrote:
      > I receive email that is not formatted properly and I need a regular
      > expression to clean it up somewhat. All lines are paragraphs AND
      > there are no blank lines between paragraphs. I need to find each line
      > that ends in ". ! or ?" and replace it with the existing punctuation
      > plus a CR-LF. Can anyone give me a clue? I know I need to use
      > the "end of line" operator $ but cannot get it to work. TIA
      >
      > Blessings,
      > Al Cantley
    • Roy Herring
      Al, try this: ^!REPLACE {[.!?]}$ 1 n ritswa Input: XX. YY XX! YY XX? YY Output: XX. YY XX! YY XX? YY Roy ... From: acantley5 To:
      Message 2 of 6 , Jun 5, 2005
      • 0 Attachment
        Al, try this:
        ^!REPLACE "{[.!?]}$" >> "\1\n" ritswa

        Input:
        XX.
        YY
        XX!
        YY
        XX?
        YY

        Output:
        XX.

        YY
        XX!

        YY
        XX?

        YY

        Roy

        ----- Original Message -----
        From: "acantley5" <acantley@...>
        To: <ntb-clips@yahoogroups.com>
        Sent: Sunday, June 05, 2005 7:30 PM
        Subject: [Clip] RegExp For Formatting Paragraphs


        >I receive email that is not formatted properly and I need a regular
        > expression to clean it up somewhat. All lines are paragraphs AND
        > there are no blank lines between paragraphs. I need to find each line
        > that ends in ". ! or ?" and replace it with the existing punctuation
        > plus a CR-LF. Can anyone give me a clue? I know I need to use
        > the "end of line" operator $ but cannot get it to work. TIA
        >
        > Blessings,
        > Al Cantley
        >
        >
        >
        >
        >
        > Fookes Software: http://www.fookes.us, http://www.fookes.com
        > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
      • acantley5
        Roy, Your expressions worked for some paragraphs but not for those that end with the ., !, or plus white space? It worked perfectly after I first trimmed
        Message 3 of 6 , Jun 6, 2005
        • 0 Attachment
          Roy,

          Your expressions worked for some paragraphs but not for those that
          end with the ., !, or plus white space? It worked perfectly after I
          first trimmed blanks from the whole document. Thanks.

          Al

          --- In ntb-clips@yahoogroups.com, "Roy Herring" <roynancy@e...>
          wrote:
          > Al, try this:
          > ^!REPLACE "{[.!?]}$" >> "\1\n" ritswa
          >
          > Input:
          > XX.
          > YY
          > XX!
          > YY
          > XX?
          > YY
          >
          > Output:
          > XX.
          >
          > YY
          > XX!
          >
          > YY
          > XX?
          >
          > YY
          >
          > Roy
          >
        • Roy Herring
          Al, This will work on your next doc even with trailing white spaces. ^!REPLACE {[.!?]} b*$ 1 n ritswa Roy ... From: acantley5
          Message 4 of 6 , Jun 6, 2005
          • 0 Attachment
            Al,

            This will work on your next doc even with trailing white spaces.
            ^!REPLACE "{[.!?]}\b*$" >> "\1\n" ritswa

            Roy

            ----- Original Message -----
            From: "acantley5" <acantley@...>
            To: <ntb-clips@yahoogroups.com>
            Sent: Monday, June 06, 2005 7:57 AM
            Subject: Re: [Clip] RegExp For Formatting Paragraphs


            > Roy,
            >
            > Your expressions worked for some paragraphs but not for those that
            > end with the ., !, or plus white space? It worked perfectly after I
            > first trimmed blanks from the whole document. Thanks.
            >
            > Al
            >
            > --- In ntb-clips@yahoogroups.com, "Roy Herring" <roynancy@e...>
            > wrote:
            >> Al, try this:
            >> ^!REPLACE "{[.!?]}$" >> "\1\n" ritswa
            >>
            >> Input:
            >> XX.
            >> YY
            >> XX!
            >> YY
            >> XX?
            >> YY
            >>
            >> Output:
            >> XX.
            >>
            >> YY
            >> XX!
            >>
            >> YY
            >> XX?
            >>
            >> YY
            >>
            >> Roy
            >>
            >
            >
            >
            >
            >
            > Fookes Software: http://www.fookes.us, http://www.fookes.com
            > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
          • rpdooling
            Roy, I played with this to solve the common problem of getting text or a doc where the paragraphs end in hard returns and there are no blank lines separating
            Message 5 of 6 , Sep 27, 2005
            • 0 Attachment
              Roy,

              I played with this to solve the common problem of getting text or a
              doc where the paragraphs end in hard returns and there are no blank
              lines separating paragraphs.

              ^!REPLACE "{[.!?"]}$" >> "\1\n" ritswa

              Works great, unless the line ends in no punctuation at all.

              Is there a way to search within NoteTab for lines of a certain length?
              I notice that the RegExp quantifiers {n} are not possible because
              NoteTab uses those for "tagged matches" as above.

              Thanks for the great snippet of useful code.

              Rick

              --- In ntb-clips@yahoogroups.com, "Roy Herring" <roynancy@e...> wrote:
              > Al,
              >
              > This will work on your next doc even with trailing white spaces.
              > ^!REPLACE "{[.!?]}\b*$" >> "\1\n" ritswa
              >
              > Roy
              >
              > ----- Original Message -----
              > From: "acantley5" <acantley@i...>
              > To: <ntb-clips@yahoogroups.com>
              > Sent: Monday, June 06, 2005 7:57 AM
              > Subject: Re: [Clip] RegExp For Formatting Paragraphs
              >
              >
              > > Roy,
              > >
              > > Your expressions worked for some paragraphs but not for those that
              > > end with the ., !, or plus white space? It worked perfectly after I
              > > first trimmed blanks from the whole document. Thanks.
              > >
              > > Al
              > >
              > > --- In ntb-clips@yahoogroups.com, "Roy Herring" <roynancy@e...>
              > > wrote:
              > >> Al, try this:
              > >> ^!REPLACE "{[.!?]}$" >> "\1\n" ritswa
              > >>
              > >> Input:
              > >> XX.
              > >> YY
              > >> XX!
              > >> YY
              > >> XX?
              > >> YY
              > >>
              > >> Output:
              > >> XX.
              > >>
              > >> YY
              > >> XX!
              > >>
              > >> YY
              > >> XX?
              > >>
              > >> YY
              > >>
              > >> Roy
              > >>
              > >
              > >
              > >
              > >
              > >
              > > Fookes Software: http://www.fookes.us, http://www.fookes.com
              > > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
              > >
              > > Yahoo! Groups Links
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
            Your message has been successfully submitted and would be delivered to recipients shortly.