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

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

Expand Messages
  • Axel Berger
    ... It is! I applied your clip unchanged to my test text from the mail before and it worked perfectly. I m using 7.1/fv on Win98SE. Axel
    Message 1 of 6 , Apr 20, 2013
    • 0 Attachment
      Art Kocsis wrote:
      > Now this is very strange!!

      It is! I applied your clip unchanged to my test text from the mail
      before and it worked perfectly.

      I'm using 7.1/fv on Win98SE.

      Axel
    • Art Kocsis
      ... I ran it on Win XP, SP2 both 5.8/fv & 6.2/fv. I saw your earlier post after I posted my clip. Interesting that the basic search patterns are almost
      Message 2 of 6 , Apr 20, 2013
      • 0 Attachment
        At 4/20/2013 09:57 AM, Axel wrote:
        >Art Kocsis wrote:
        >> Now this is very strange!!
        >
        >It is! I applied your clip unchanged to my test text from the mail
        >before and it worked perfectly.
        >
        >I'm using 7.1/fv on Win98SE.

        I ran it on Win XP, SP2 both 5.8/fv & 6.2/fv.

        I saw your earlier post after I posted my clip. Interesting that the basic search patterns are almost identical. I added the (?s) override to handle multiple lines, the \s to help insure that it finds a proper tag, made the target non-greedy to prevent problems, and added the "H" parameter to allow for optional preselection.

        Axel: ^!Replace "<span[^>]*>(.*?)</span>" >> "<i>$1</i>" R
        Art: ^!Replace "(?s)<span\s[^>]*?>(.*?)</span>" >> "<i>$1</i>" IHRS

        After verifying that the search pattern worked I was all ready to post it (as the replacement pattern was trivial), but paused to make sure there were no typos in the command when the gremlins hit. I have spent way too much time on this but am concerned about what kind of hidden bug may be involved.

        Do you still have any earlier versions installed?

        Could some other people try this and report back? A test string is:

        <span style='font-family:"Times New Roman Italic","serif"'>(.*?)</span>

        I think it's time to reboot and see if anything changes.
        Either result is not good but at least it is a data point.

        =================================
        At 4/20/2013 04:18 AM, Hitch wrote:
        >It's never the same information inside the span.

        Hitch, I'll say this once more as you either didn't read carefully or didn't understand. What Axel and I are both trying to tell you is that the pattern "\s[^>]*?>" captures ALL POSSIBLE attributes in the opening tag. It says match all characters EXCEPT a ">" followed by a ">".

        To check it out change the ^!Replace to a ^!Find, put the command in a clip and save it, drag the clip to your clipbar, open one of your docs and clip on the clipbar icon. Each time you click it will find the next occurrence. When we get the replace part straightened out, change back to a ^!Replace command, go to the first one you want to change and keep clicking on the icon until done. for those you don't want to change just move the cursor past the current selection. You can modify this to pause at each find (see ^!Skip), and just go through a doc once.
      • Axel Berger
        ... I just tested your clip: ^!Replace (?s) ]*? (.*?) $1 IHRS on my text:
        Message 3 of 6 , Apr 20, 2013
        • 0 Attachment
          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
        • 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 4 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 5 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 6 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.