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

Re: [Clip] Dot matches newline ON or OFF (was Re: Non printingcharacters.)

Expand Messages
  • Art Kocsis
    ... Aye, and therein lies the rub: on my text . Had you run the test on my posted test string you would have noticed something different. [Remember your
    Message 1 of 6 , Apr 20, 2013
    • 0 Attachment
      At 4/20/2013 04:14 PM, you wrote:
      >
      >
      >Art Kocsis wrote:
      >> I ran it on Win XP, SP2 both 5.8/fv & 6.2/fv.
      >
      >I just tested your clip:
      >^!Replace "(?s)<span\s[^>]*?>(.*?)</span>" >> "<i>$1</i>" IHRS
      >
      >on my text:
      ><span style='font-family:"Times New Roman Italic","serif"'>and they
      >lived happily ever after</span>
      >
      >in both 5.8/fv and 6.2/fv under Win98SE and it worked flawlessly both
      >times.
      >
      >Axel

      Aye, and therein lies the rub: "on my text". Had you run the test on my posted test string you would have noticed something different. [Remember your advice about copy and paste vs typing? ;-)]

      After my last post I decided to try my clip on the real test data that Hitch finally posted and it worked quite well. There was omething strange about the test string I was using.

      I really need to get more sleep, better glasses or something. I had been using the only thing that Hitch had posted that resembling a test string and failed to notice that tag's "content" between the ">" and "<" was "(.*?)" !!! DUH! But at least there is no hidden bug in RegEx.

      Please people, when you post a question copy and paste data real data to help avoid mistakes such as I made.

      Anyway, since I had all this time invested I went ahead and flushed out the clip to work an entire doc with a UI to verify a replacement.

      ;############ Start of Clip ############
      ^!Jump Doc_Start
      :Loop
      ^!Find "(?s)<span[^>]*?\>(.*?)</span>" IRS
      ^!IfError END
      ^!Skip Skip this selection?
      ^!Replace "(?s)<span[^>]*?\>(.*?)</span>" >> "<i>$1</i>\r\n" IHRS
      ^!GoTo Loop
      ;############ End of Clip ############

      Hitch, regarding your $1 results, you may want to read the "What's New" for version 7. Especially about the new wild card feature for F&R. Also try <i>$0</i> as your replace string to see what you are actually capturing.

      Art
    • Axel Berger
      ... Sorry, my mistake. I hadn t read your post closely enpough and overlooked that bit. Now (.*?) is a strange piece of text, but neverless the regex (.*?)
      Message 2 of 6 , Apr 21, 2013
      • 0 Attachment
        Art Kocsis wrote:
        > Had you run the test on my posted test string you would have
        > noticed something different.
        > [Remember your advice about copy and paste vs typing? ;-)]

        Sorry, my mistake. I hadn't read your post closely enpough and
        overlooked that bit. Now "(.*?)" is a strange piece of text, but
        neverless the regex '(.*?)' captures it and $1 reproduces it, so your
        Replace yields "<i>(.*?)</i>"

        Again here everything works fine in all three versions.

        > But at least there is no hidden bug in RegEx.

        So we agree again.
        Hitch, there's no problem that I can see or reproduce, so it's up to you
        to provide an actual example for us.

        Axel
      • Art Kocsis
        ... Hey, I hope you realize that I was just pulling your chain a little - no criticism meant. Just trying to take some of the sting off realizing how blind I
        Message 3 of 6 , Apr 21, 2013
        • 0 Attachment
          At 4/21/2013 01:21 AM, you wrote:
          >Art Kocsis wrote:
          >> Had you run the test on my posted test string you would have
          >> noticed something different.
          >> [Remember your advice about copy and paste vs typing? ;-)]
          >
          >Sorry, my mistake. I hadn't read your post closely enpough and
          >overlooked that bit. Now "(.*?)" is a strange piece of text, but
          >neverless the regex '(.*?)' captures it and $1 reproduces it, so your
          >Replace yields "<i>(.*?)</i>"

          Hey, I hope you realize that I was just pulling your chain a little - no criticism meant. Just trying to take some of the sting off realizing how blind I can be once I get an idea in my head. I looked at the result, looked at my pattern - they were identical - and never looked back at the original. Dumb! It will be a while before I forget this.

          Yes, it did exactly as I said. Way back in grad school one of my teachers talked about a new language - DWIMDI! - "Do What I Mean, Damm It!" Too bad it doesn't exist.


          Namaste', Art

          My mind is like the subway. If I end up where I'm going,
          it's best if I don't try to understand the system.
          Jef Mallett, 04-21-13
        Your message has been successfully submitted and would be delivered to recipients shortly.