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

RE: [Clip] Re: Handling periods at ends of lines

Expand Messages
  • John Shotsky
    Flo, Yes, you have interpreted my requirements correctly. Also, your clip does it as needed. I would never have come up with that on my own. It ll be worked
    Message 1 of 23 , Apr 9, 2009
    • 0 Attachment
      Flo,



      Yes, you have interpreted my requirements correctly. Also, your clip does it as needed. I would never have come up with
      that on my own. It'll be worked into my clip library in several places.



      I didn't know the dot was considered literally inside a character class.that probably explains why some of my previous
      clips didn't work as I expected. (I usually try things quite a few ways before I ask for help.). Also, when searching
      for line ends, I almost always use \R, which matches any kind of line end. If I'm replacing, I use \n as the
      replacement.



      Sorry to be late in answering - I contracted a virus 'HACKTOOL' from a web site, and it took out my boot drive. I wasn't
      even doing anything, but up came a blue screen of death, computer halted, then wouldn't boot again. I've spent the last
      couple days rebuilding from scratch almost. Yes, I ordinarily run virus software all the time, but I had just rebuilt
      this system and was waiting for my Norton antivirus software to arrive, so I was browsing the internet using only sites
      that I'd been to before safely. Unfortunately, one of them now slips you HACKTOOL when you visit. In case any of you
      have been browsing for graphic/image utilities, don't even think about visiting wwwdotbrothersoftdotcom.



      John



      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Flo
      Sent: Tuesday, April 07, 2009 9:17 AM
      To: ntb-clips@yahoogroups.com
      Subject: [Clip] Re: Handling periods at ends of lines



      --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
      >
      > Thank you again, I was still missing how the dot was working when
      > looking at the clip and looking at my sample....

      John,

      Let me first try again to clear the job you want to do.

      My test lines are...

      This is an example line without a period
      Another line with a period.
      This is an example line with a period.
      Another line without a period
      This is an example line without a period

      I understand that you want to add a period to line #1 and #5 only. That is, to lines which (a) contain the sample string
      "This is an example line", and which (b) don't end with a period.

      So here's another proposal which combines Sheri's approach with the sample string...

      ^!Replace "^(This is an example line.*)[^\r\n.]\K$" >> "." AWRS

      It adds a period to line #1 and #5 only. The rest is ignored. Is this the job you want to do?

      Maybe I misunderstood the whole issue and you want to add a period to ANY line that doesn't end with a period. In this
      case, Sheri's proposal...

      ^!Replace "[^\r\n.]\K$" >> "." AWRS

      would the job, of course.

      Flo

      P.S. to Alec:

      Your first solution (without ?m)...

      ^!replace "(?<!\.)$" >> "." rwsai

      works fine for me too. Since it adds a period to ANY line that doesn't end with a period it possibly doesn't meet the
      job (matching that sample string) (??)

      > Another way is:
      > ^!replace "(?m)([^\.])$" >> "$1." rwsai

      This doesn't work for me. It "splits" the CRNL at the end of each line because, with [^\.], also the CR is matched. So,
      at the end of line #1 to #4, we get ".CR.CRNL".

      By the way: We don't have to escape the dot here -- inside a character class, it's always regarded as a literal dot.






      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.