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

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

Expand Messages
  • Art Kocsis
    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
    • Show all 6 messages in this topic