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

Using regex to insert a comment

Expand Messages
  • paulmaser
    I ve been working on a problem for a while and came up with a solution that I would like to share. I categorize a webpage with comments to seperate topics and
    Message 1 of 15 , Mar 1, 2009
    View Source
    • 0 Attachment
      I've been working on a problem for a while and came up with a
      solution that I would like to share.

      I categorize a webpage with comments to seperate topics and was
      searching for a way to insert the body of the comment into the added
      lines that was quick and clean.

      <!-- UN: -->
      <!-- Caribbean: -->
      <!-- Mexico: -->
      <!-- South America: -->

      and when a new item is added:

      <!-- UN: -->
      <!-- Caribbean: -->
      <!-- Mexico: -->
      <li><b><i>Melbourne Age</i></b> asdf mjmdof aselkmd fod
      <!-- South America: -->

      And after the clip is run:

      <!-- UN: -->
      <!-- Caribbean: -->
      <!-- Mexico: -->
      <li>Mexico: <b><i>Melbourne Age</i></b> asdf mjmdof aselkmd fod
      <!-- South America: -->

      A simple regex clip to find the comment and insert it into the
      following list items is this:

      ^!Set %findvar%=<!-- (.+: )-->\s?(\r\n<li.*?>(.*?).*)+
      :LoopStart
      ^!Find "^%findvar%" CRS1
      ^!IfError EndLoop
      ^!Set %cc%=^$GetSelection$
      ;^!Info ^%cc%
      ^!Jump Line_Start
      ^!Find "^%findvar%" CRS
      ^!Replace "(<li.*?>)(<b>)" >> "$1^%cc%$2" ACHRS
      ^!Jump Line_End
      ^!GoTo LoopStart
      :EndLoop

      It sets a variable(%findvar%) to the regex find expression because it
      is used more than once(eliminates typos).

      Starts a loop that finds the first comment with a line added
      underneath. The regex(%fundvar%) looks for multiple lines between
      comments, which causes those that don't have any added lines to be
      skipped.

      The Find CRS1 selects the text inside the comment and this is set to
      the variable %cc%

      Jumps to the start of the line.

      Finds the regex expression %findvar% again, but this time selects the
      entire regex and not just the text in the comment. First search used
      CRS1 and second search uses CRS.

      Then replace the <li><b> part of the entry with <li>%cc%<b>, which
      add the region to the entry.

      Jump line end deselects the selection, places the cursor above the
      next comment and restarts the loop.

      The interesting part of this little clip is that a post here that
      showed me how to use FIND, a couple of other posts on arrays and a
      little serendipity allowed me to code a clip that is almost
      instantaneous (except in Vista).

      I have been working on this for about two years and every solution I
      came up with was not satisfactory. This one works so well that I felt
      obligated to post it.

      Thanks everyone for your help on this.
      Paul
    • Flo
      ... Paul, I understand that the lines... Melbourne... are replaced with... Mexico: Melbourne... Isn t
      Message 2 of 15 , Mar 2, 2009
      View Source
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "paulmaser" <paul@...> wrote:
        >
        > I've been working on a problem for a while and came up with a
        > solution that I would like to share(...)Then replace the <li><b>
        > part of the entry with <li>%cc%<b>, which add the region to
        > the entry.

        Paul,

        I understand that the lines...

        <!-- Mexico: -->
        <li><b><i>Melbourne...

        are replaced with...

        <!-- Mexico: -->
        <li>Mexico: <b><i>Melbourne...

        Isn't that done with just the following line...

        ^!Replace "(\w+:\x20)\K(-->\r\n<li>)(<b><i>)" >> "$2$1$3" AWRS

        ...matching all occurrences of that pattern?

        Regards,
        Flo
         
      • paulmaser
        Flo; You are certainly a master at this. I will have to spend some time trying to figure out what you are doing. Thanks, as always. Paul
        Message 3 of 15 , Mar 2, 2009
        View Source
        • 0 Attachment
          Flo;
          You are certainly a master at this.
          I will have to spend some time trying to figure out what you are doing.
          Thanks, as always.
          Paul


          > Isn't that done with just the following line...
          >
          > ^!Replace "(\w+:\x20)\K(-->\r\n<li>)(<b><i>)" >> "$2$1$3" AWRS
          >
          > ...matching all occurrences of that pattern?
          >
          > Regards,
          > Flo
        • paulmaser
          ... Flo; Thanks again, I ve had some time to play with, but if there are multiple lines entered after the comment it ignores them. This was always my problem.
          Message 4 of 15 , Mar 2, 2009
          View Source
          • 0 Attachment
            > ^!Replace "(\w+:\x20)\K(-->\r\n<li>)(<b><i>)" >> "$2$1$3" AWRS

            Flo;
            Thanks again, I've had some time to play with, but if there are
            multiple lines entered after the comment it ignores them. This was
            always my problem. Is there some magic formula in regex to get this to
            handle multiple entries/

            Paul
          • Flo
            ... Paul, So far, I understood that there are comments like... and added lines like... Melbourne Age asdf mjmdof aselkmd
            Message 5 of 15 , Mar 3, 2009
            View Source
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "paulmaser" <paul@...> wrote:
              >
              > ...if there are multiple lines entered after the comment it
              > ignores them. This was always my problem. Is there some magic
              > formula in regex to get this to handle multiple entries

              Paul,

              So far, I understood that there are "comments" like...

              <!-- Mexico: -->

              and "added lines" like...

              <li><b><i>Melbourne Age</i></b> asdf mjmdof aselkmd fod

              which, in your examples, always immediately follow the "comment".

              What does this new condition look like? Could you give us a few
              examples, please?

              Regards,
              Flo
               
            • paulmaser
              Flo; Here is what today s post look like at the moment: The reader wraps the lines, which makes it difficult to read. Thanks; Paul
              Message 6 of 15 , Mar 3, 2009
              View Source
              • 0 Attachment
                Flo;
                Here is what today's post look like at the moment:
                The reader wraps the lines, which makes it difficult to read.
                Thanks;
                Paul

                <!-- Caribbean: -->
                <!-- Mexico: -->
                <!-- South America: -->
                <!-- Canada: -->
                <!-- Asia-Pacific: -->
                <!-- Asia: -->
                <!-- East Asia: -->
                <li>East Asia: <b><i>AP Google</i></b> - <a
                href="http://www.google.com/hostednews/ap/article/ALeqM5g6bEeGoPxwPaVE
                5cl67rsVW7wASQD96MF2DG1">US monitoring NKorea missile activity from
                Japan</a> - Eric Talmadge
                <li>East Asia: <b><i>AFP Google</i></b> - <a
                href="http://www.google.com/hostednews/afp/article/ALeqM5haqB_LlvMTmT7
                IVX3jfJoaWQ_3Sw">NKorea raps US-SKorean exercise after rare talks</a>
                <li>East Asia: <b><i>Reuters UK</i></b> - <a
                href="http://uk.reuters.com/article/worldNews/idUKTRE5221FQ20090303">F
                actbox - New U.S. envoy to North Korea nuclear talks</a>
                <li>East Asia: <b><i>Xinhua News</i></b> - <a
                href="http://news.xinhuanet.com/english/2009-
                03/03/content_10937224.htm">U.S. special representative on DPRK
                visits China</a>
                <li>East Asia: <b><i>Chosun Ilbo</i></b> - <a
                href="http://english.chosun.com/w21data/html/news/200903/200903030029.
                html">S.Korea Appoints New Top Nuclear Negotiator</a>
                <li>East Asia: <b><i>Yonhap News</i></b> - <a
                href="http://english.yonhapnews.co.kr/northkorea/2009/03/03/19/0401000
                000AEN20090303006300315F.HTML">N. Korea, U.N. Command to hold more
                military talks this week: officials</a> - Sam Kim
                <li>East Asia: <b><i>Yonhap News</i></b> - <a
                href="http://english.yonhapnews.co.kr/northkorea/2009/03/03/76/0401000
                000AEN20090303005200315F.HTML">N. Korea says it's ready for war in
                face of S. Korea-U.S. joint drill</a> - Kim Hyun
                <li>East Asia: <b><i>Yonhap News</i></b> - <a
                href="http://english.yonhapnews.co.kr/northkorea/2009/03/03/12/0401000
                000AEN20090303002400315F.HTML">Russia's top nuclear envoy due in
                Seoul next week</a> - Lee Chi-dong
                <li>East Asia: <b><i>Yonhap News</i></b> - <a
                href="http://english.yonhapnews.co.kr/northkorea/2009/03/03/60/0401000
                000AEN20090303002000315F.HTML">N. Korea calls Lee's dialogue
                offer 'disgusting'</a>
                <!-- Southeast Asia: -->
                <!-- Central Asia: -->
                <!-- Southwest Asia: -->
                <!-- South Asia: -->
                <!-- Europe: -->
                <li>Europe: <b><i>Derby Evening Telegraph</i></b> - <a
                href="http://www.thisisderbyshire.co.uk/news/Rolls-Royce-given-major-
                contract-build-sub-s-reactor/article-739473-
                detail/article.html">Rolls-Royce is given major contract to build
                sub's reactor</a>
                <li>Europe: <b><i>Glasgow Herald</i></b> - <a
                href="http://www.theherald.co.uk/features/letters/display.var.2492875.
                0.Nuclear_waste.php">Letter: Nuclear waste</a> - Thomas W Durning
                <li>Europe: <b><i>North West Evening Mail</i></b> - <a
                href="http://www.nwemail.co.uk/news/demand_to_know_site_of_millom_nuke
                _plant_1_520818?referrerPath=news">Demand to know site of Millom nuke
                plant</a>
                <li>Europe: <b><i>Nuclear Engineering</i></b> - <a
                href="http://www.neimagazine.com/story.asp?
                sectioncode=147&storyCode=2052302">New nuclear build - sufficient
                supply capability?</a>
                <li>Europe: <b><i>Nuclear Engineering</i></b> - <a
                href="http://www.neimagazine.com/story.asp?
                sectioncode=132&storyCode=2052295">IAEA nuclear fuel bank moves step
                closer, says ElBaradei</a>
                <li>Europe: <b><i>Nuclear Engineering</i></b> - <a
                href="http://www.neimagazine.com/story.asp?
                sectionCode=132&storyCode=2052300">Enel and EDF lay plans for a
                nuclear Italy</a>
                <!-- North Europe: -->
                <li>North Europe: <b><i>Helsingin Sanomat</i></b> - <a
                href="http://www.hs.fi/english/article/Competitors+doubt+Fennovoima%
                E2%80%
                99s+ability+to+finance+new+nuclear+power+plant/1135243985704">Competit
                ors doubt Fennovoima's ability to finance new nuclear power plant</a>
                <!-- East Europe: -->
                <li>East Europe: <b><i>Slovak Spectator</i></b> - <a
                href="http://www.spectator.sk/articles/view/34543/10/russians_consider
                _slovakia_as_site_for_nuclear_fuel_plant.html">Russians consider
                Slovakia as site for nuclear fuel plant</a>
                <!-- Russia: -->
                <li>Russia: <b><i>BBC News</i></b> - <a
                href="http://news.bbc.co.uk/2/hi/americas/7920759.stm">US 'offers
                Russia deal over Iran'</a>
                <li>Russia: <b><i>BBC News</i></b> - <a
                href="http://news.bbc.co.uk/2/hi/americas/7920555.stm">Will Russia
                accept US defence deal?</a> - Paul Reynolds
                <li>Russia: <b><i>Washington Post</i></b> - <a
                href="http://www.washingtonpost.com/wp-
                dyn/content/article/2009/03/03/AR2009030300028.html">Obama Makes
                Overtures to Russia on Missile Defense</a> - Michael A. Fletcher
                <li>Russia: <b><i>AFP Google</i></b> - <a
                href="http://www.google.com/hostednews/afp/article/ALeqM5hx6T_320DLuej
                f3CHP5mT-MbaKfA">Obama offers Moscow missile defense deal</a>
                <li>Russia: <b><i>Reuters UK</i></b> - <a
                href="http://uk.reuters.com/article/worldNews/idUKTRE5222ON20090303">C
                linton says missile shield to protect from Iran</a>
                <li>Russia: <b><i>Reuters</i></b> - <a
                href="http://www.reuters.com/article/topNews/idUSTRE5220RS20090303">Ob
                ama writes Russia president about Iran, missiles: report</a>
                <!-- Middle East: -->
                <li>Middle East: <b><i>Los Angeles Times</i></b> - <a
                href="http://www.latimes.com/news/nationworld/world/la-fg-clinton3-
                2009mar03,0,2804433.story">Clinton says U.S. diplomacy unlikely to
                end Iran nuclear program</a> - Paul Richter
                <li>Middle East: <b><i>New York Times</i></b> - <a
                href="http://www.nytimes.com/2009/03/03/opinion/l03iran.html">Letter:
                Iran's View on Uranium</a> - M. A. Mohammadi
                <li>Middle East: <b><i>Washington Post</i></b> - <a
                href="http://www.washingtonpost.com/wp-
                dyn/content/article/2009/03/02/AR2009030200597.html">Clinton
                Pessimistic on Iran Outreach</a> - Glenn Kessler
                <li>Middle East: <b><i>Washington Post</i></b> - <a
                href="http://www.washingtonpost.com/wp-
                dyn/content/article/2009/03/02/AR2009030201951.html">To Talk With
                Iran, Stop Not Talking</a> - James Dobbins
                <li>Middle East: <b><i>AP Google</i></b> - <a
                href="http://www.google.com/hostednews/ap/article/ALeqM5jfS6y-
                A7WF82KotI6KMN41IA3M4QD96MCN7G0">Report: Obama sought Russian deal on
                Iran</a>
                <!-- North Africa: -->
                <!-- West Africa: -->
                <!-- South Africa: -->
              • Flo
                ... Paul, That s a lot of lines -- could we reduce it as follows? AP Google -
                Message 7 of 15 , Mar 3, 2009
                View Source
                • 0 Attachment
                  --- In ntb-clips@yahoogroups.com, "paulmaser" <paul@...> wrote:
                  >
                  > Flo;
                  > Here is what today's post look like at the moment...

                  Paul,

                  That's a lot of lines -- could we reduce it as follows?


                  <!-- Asia-Pacific: -->
                  <!-- Asia: -->
                  <!-- East Asia: -->
                  <li><b><i>AP Google</i></b> - <a href=...Eric Talmadge
                  <li><b><i>AFP Google</i></b> - <a href=...talks</a>
                  <li><b><i>Reuters UK</i></b> - <a href=...talks</a>
                  <!-- Southeast Asia: -->
                  <!-- Europe: -->
                  <li><b><i>Derby Evening Telegraph</i></b> - <a href=...reactor</a>
                  <!-- North Europe: -->


                  Different from your first example, the number of those "added lines" now differs from comment to comment. I assume that the "added lines" contain *no CRNL* (i.e., they are multiple lines of a single paragraph only).

                  When running the following clip on these lines...


                  ^!SetScreenUpdate Off
                  ^!SetWordWrap Off
                  ^!Jump Doc_Start
                  :Start
                  ^!Find "(?s)^<!--[^-]+-->\x20\r\n<li>.+?((?=^<!)|\Z)" RS
                  ^!IfError End
                  ; Long line start
                  ^!SetClipboard ^$GetDocMatchAll("^<\!--\x20\K([^-]+)(?=-->\x20\r\n<li>)")$
                  ; Long line end
                  ^!Replace "(<li>)(<b>)" >> "$1^$GetClipboard$$2" HARS
                  ^!Jump Select_End
                  ^!If ^$GetRow$=^$GetTextLineCount$ End
                  ^!Goto Start


                  ...the result is:


                  <!-- Asia-Pacific: -->
                  <!-- Asia: -->
                  <!-- East Asia: -->
                  <li>East Asia: <b><i>AP Google</i></b> - <a href=...Eric Talmadge
                  <li>East Asia: <b><i>AFP Google</i></b> - <a href=...talks</a>
                  <li>East Asia: <b><i>Reuters UK</i></b> - <a href=...talks</a>
                  <!-- Southeast Asia: -->
                  <!-- Europe: -->
                  <li>Europe: <b><i>Derby Evening Telegraph</i></b> - <a href=...reactor</a>
                  <!-- North Europe: -->


                  I hope this will match your intentions...

                  Regards,
                  Flo

                  P.S. I also played around with the following solution -- with a long list, it will be slower...


                  ^!SetWordWrap Off
                  ^!Jump Doc_Start
                  :Start
                  ^!Find "^<\!--\x20\K([^-]+)(?=-->\x20\r\n<li>)" RS
                  ^!IfError End
                  ^!Set %Body%=^$GetSelection$
                  ^!Jump +1
                  ^!IfSame "<li>" "^$StrCopyLeft("^$GetLine$";4)$" Next Else Start
                  ^!Replace "(<li>)(<b>)" >> "$1^%Body%$2" RS
                  ^!If ^$GetRow$=^$GetTextLineCount$ End
                  ^!Goto Skip_-4
                • paulmaser
                  Flo; Once again, your regex is beyond my ability to comprehend and I will have to dive into the manual to understand what you are doing. It looks like it gives
                  Message 8 of 15 , Mar 4, 2009
                  View Source
                  • 0 Attachment
                    Flo;
                    Once again, your regex is beyond my ability to comprehend and I will have to dive into the manual to understand what you are doing. It looks like it gives me exactly what I needed. Using the clipboard to store is pretty nifty. Your use of \K is really inovative.
                    Thanks again;
                    Paul

                    > When running the following clip on these lines...
                    >
                    >
                    > ^!SetScreenUpdate Off
                    > ^!SetWordWrap Off
                    > ^!Jump Doc_Start
                    > :Start
                    > ^!Find "(?s)^<!--[^-]+-->\x20\r\n<li>.+?((?=^<!)|\Z)" RS
                    > ^!IfError End
                    > ; Long line start
                    > ^!SetClipboard ^$GetDocMatchAll("^<\!--\x20\K([^-]+)(?=-->\x20\r\n<li>)")$
                    > ; Long line end
                    > ^!Replace "(<li>)(<b>)" >> "$1^$GetClipboard$$2" HARS
                    > ^!Jump Select_End
                    > ^!If ^$GetRow$=^$GetTextLineCount$ End
                    > ^!Goto Start
                  • Don - HtmlFixIt.com
                    Um yes Flo, can you break that down for the slow kids in the back here?
                    Message 9 of 15 , Mar 4, 2009
                    View Source
                    • 0 Attachment
                      Um yes Flo, can you break that down for the slow kids in the back here?

                      paulmaser wrote:
                      > Flo;
                      > Once again, your regex is beyond my ability to comprehend and I will have to dive into the manual to understand what you are doing. It looks like it gives me exactly what I needed. Using the clipboard to store is pretty nifty. Your use of \K is really inovative.
                      > Thanks again;
                      > Paul
                      >
                      >> When running the following clip on these lines...
                      >>
                      >>
                      >> ^!SetScreenUpdate Off
                      >> ^!SetWordWrap Off
                      >> ^!Jump Doc_Start
                      >> :Start
                      >> ^!Find "(?s)^<!--[^-]+-->\x20\r\n<li>.+?((?=^<!)|\Z)" RS
                      >> ^!IfError End
                      >> ; Long line start
                      >> ^!SetClipboard ^$GetDocMatchAll("^<\!--\x20\K([^-]+)(?=-->\x20\r\n<li>)")$
                      >> ; Long line end
                      >> ^!Replace "(<li>)(<b>)" >> "$1^$GetClipboard$$2" HARS
                      >> ^!Jump Select_End
                      >> ^!If ^$GetRow$=^$GetTextLineCount$ End
                      >> ^!Goto Start
                      >
                    • Flo
                      ... Here we go... (?s) = dot matches all modifier (also NL to match multiple lines) ^
                      Message 10 of 15 , Mar 5, 2009
                      View Source
                      • 0 Attachment
                        --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
                        >
                        > Um yes Flo, can you break that down for the slow kids in the
                        > back here?

                        Here we go...

                        (?s) = "dot matches all" modifier (also NL to match multiple lines)

                        ^<!-- = matches at start of a comment line

                        [^-]+ = character class: any character that is no "-" (i.e. the body of comment)

                        -->\x20\r\n = matches at end of comment line, followed by a space (in hex), and a CRNL

                        <li> = matches at start of an added line (to identify added lines following a comment line)

                        .+?((?=^<!)|\Z) = matches one or more (non-greedy) following added lines up to the next comment line using a Positive Lookahead Assertion (?=^<!) embedded in an alternation: matches either before "^<!", i.e. the start of a comment line, or at end of list (\Z) if last line is an added line.

                        The second RegEx (in ^$GetDocMatchAll$)...

                        ^<\!--\x20\K([^-]+)(?=-->\x20\r\n<li>)

                        matches the body of a comment line only:

                        ^<\!--\x20\K = matches at start of comment line (obviously the escaping of the exclamation mark isn't necessary here), followed by a space (in hex) but, with \K, doesn't select the match. Since ^$GetDocMatchAll$ searches only within the selection made by ^!Find, it captures the body in that block only (cf the "CRS1" used by Paul to capture the first subpattern only).

                        I love to play with that different solutions. I also like Pauls approach. Maybe it's a little bit slower with very large lists because every ^!Find and ^!Jump slows down a clip whereas those ^$GetDoc-Functions are extremely fast.

                        But in the end it doesn't matter very much -- "many roads lead to Rome" ;-)

                        Regards,
                        Flo

                        P.S. My clip (revised):

                        ^!SetScreenUpdate Off
                        ^!Jump Doc_Start
                        :Start
                        ^!Find "(?s)^<!--[^-]+-->\x20\r\n<li>.+?((?=^<!)|\Z)" RS
                        ^!IfError End
                        ^!SetClipboard ^$GetDocMatchAll("^<!--\x20\K([^-]+)(?=-->\x20\r\n<li>)")$
                        ^!Replace "(<li>)(<b>)" >> "$1^$GetClipboard$$2" HARS
                        ^!Jump Select_End
                        ^!Goto Start

                        Please note when testing it with Paul's big list: This list is processed, i.e. it contains those bodies already; also, you have to remove a dozen CRNL inserted by this forum. That is, all lines have to start either with "<!--" or "<li><b>" (when word wrap is off).
                      • paulmaser
                        Flo; I am having a hard time understanding how Z works. Could you expand on your explanation? Thanks; Paul
                        Message 11 of 15 , Mar 5, 2009
                        View Source
                        • 0 Attachment
                          Flo;
                          I am having a hard time understanding how \Z works.
                          Could you expand on your explanation?
                          Thanks;
                          Paul
                        • Flo
                          ... Paul, There s an upper Z and a lower z. Imagine a document that ends with the following two lines... This is next to last line This is the last line With
                          Message 12 of 15 , Mar 5, 2009
                          View Source
                          • 0 Attachment
                            --- In ntb-clips@yahoogroups.com, "paulmaser" <paul@...> wrote:
                            >
                            > Flo;
                            > I am having a hard time understanding how \Z works.
                            > Could you expand on your explanation?

                            Paul,

                            There's an upper \Z and a lower \z. Imagine a document that ends with the following two lines...

                            This is next to last line
                            This is the last line

                            With lower \z...

                            ^!Find "line\z" RS

                            ...the RegEx will match the word "line" at the end of the last line in case it isn't followed by another NL.

                            With upper \Z, the RegEx will match that word, no matter if there is one more NL or not.

                            Regards,
                            Flo
                             
                          • paulmaser
                            Flo; Thanks, that helps. By the way, that is a nice piece of work you coded. You showed me some stuff I would have never figured out. Paul
                            Message 13 of 15 , Mar 6, 2009
                            View Source
                            • 0 Attachment
                              Flo;
                              Thanks, that helps.
                              By the way, that is a nice piece of work you coded.
                              You showed me some stuff I would have never figured out.
                              Paul
                              >
                              > There's an upper \Z and a lower \z. Imagine a document that ends with the following two lines...
                              >
                              > This is next to last line
                              > This is the last line
                              >
                              > With lower \z...
                              >
                              > ^!Find "line\z" RS
                              >
                              > ...the RegEx will match the word "line" at the end of the last line in case it isn't followed by another NL.
                              >
                              > With upper \Z, the RegEx will match that word, no matter if there is one more NL or not.
                              >
                              > Regards,
                              > Flo
                              >  
                              >
                            • Michael Frascinella
                              Flo, I tried a test of ^!Find line z RS and ^!Find line Z RS using your sample text. Both assertions found only the last instance of line on the last
                              Message 14 of 15 , Mar 6, 2009
                              View Source
                              • 0 Attachment
                                Flo,

                                I tried a test of
                                ^!Find "line\z" RS
                                and
                                ^!Find "line\Z" RS
                                using your sample text.

                                Both assertions found only the last instance of "line" on the last line
                                and not on a preceding line. Your explanation and the online help said
                                they work slightly differently but I don't see it.

                                Yours,

                                Michael F
                                ******************
                                Never Forget
                                September 11, 2001
                                ******************





                                [Non-text portions of this message have been removed]
                              • Flo
                                Michael, ... Well, that s the way it works. The first instance of line is not at the end of subject (Help on RegEx). So it isn t matched. As I said, the
                                Message 15 of 15 , Mar 7, 2009
                                View Source
                                • 0 Attachment
                                  Michael,

                                  > Both assertions found only the last instance of "line" on the
                                  > last line and not on a preceding line.

                                  Well, that's the way it works. The first instance of "line" is not at "the end of subject" (Help on RegEx). So it isn't matched.

                                  As I said, the difference between \Z and \z has to do with a New Line at the end of the document. Please test it again: (A) with another CRNL after the second "line" and (B) without.

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