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

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

Expand Messages
  • Art Kocsis
    ... Why is because (from what you have told us), it is a perfect application for a clip using RegEx. .* is exactly what ANYTHING that somebody in their
    Message 1 of 16 , Apr 20, 2013
    • 0 Attachment
      At 4/19/2013 05:18 PM, Hitch wrote:
      >With the named span inserted where the "italic span" text is now. When I say that this is a 'clip,' I keep it stored in my clips, but as it's never the same (the name and other material for the span can be ANYTHING that somebody in their brain thought up, any name for the span, any font, etc.), it's not viable as a regular "clip." I mean, I could automate it, to the pasting, but...why?
      >
      >So, I copy-and-paste the name of the span, e.g.:
      >
      ><span style='font-family:"Times New Roman Italic","serif"'>(.*?)</span>
      >
      >then select regex, and then, in the replace box, I've simply always put:
      >
      ><i>$1</i>


      "Why" is because (from what you have told us), it is a perfect application for a clip using
      RegEx. ".*" is exactly what "ANYTHING that somebody in their brain thought up" matches.

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

      When you see a $n (n=digit), in the result it means the referenced capture substring is undefined. Note: a null string is still defined.


      Now this is very strange!! The find works fine but the replace is going bananas.
      The result of that command on your test line is:

      <i>(.*?)</i>

      The parenthesis meta characters are being treated as ordinary characters.

      Stranger still (added alternate pattern and set min capture to 1):

      ^!Replace "(?s)<span\s[^>]*?>(.+?|ZZZ)</span>" >> "<i>$1</i>" IHRS

      Applied to (added "Z" between ">" and "("):

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

      Still results in:

      <i>Z(.*?)</i>

      OK, full debug mode (grouped tags & escaped ">"), group debug output.

      Command (long line ahead followed by parenthesis verification):

      ^!Replace "(?s)(<span\s[^>]*?\>)(.+?|ZZZ)(</span>)" >> "\r\n\$0='$0'\r\n\$1='$1'\r\n\$2='$2'\r\n\$3='$3'\r\n" IRST
      ( )( )( | )( )

      Test string:

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

      Command Results:

      $0='<span style='font-family:"Times New Roman Italic","serif"'>Z(.*?)</span>'
      $1='<span style='font-family:"Times New Roman Italic","serif"'>'
      $2='Z(.*?)'
      $3='</span>'

      WIH is going on??? Same behavior with both NTS v5.8/fv & v6.2/fv.
      Why is the (.*?) pattern not being treated as a group yet the other ones are?
      This should have been a quick reply with a simple command the gremlins have attacked again.

      Art
    Your message has been successfully submitted and would be delivered to recipients shortly.