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

22504Thanks for help on "replacing text, depending on other text in the same line."

Expand Messages
  • Brian
    May 7, 2012
      Thanks for the responses to my question on this. My first post - what a helpful lot you are!

      Flo's search string ((ABC(?=.+KLM))|(KLM.*\KABC)) was great. It was easy to tailor it to the actual strings I was working with, it did just what I wanted and solved my problem. You would probably expect that, seeing how it had been tested by Flo, as documented in the message. I'll admit to knowing little about regular expressions, so I've got some work to do to understand why it works.

      SNOBOL4 ... I've no experience with that, though I once enquired about a job using it. I think it was investigating natural language translation. But for this problem I was looking at coding something in a .NET language with its string handling. Fortunately, I've been saved from that.


      --- In notetab@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
      > Search: (ABC(?=.+KLM))|(KLM.*\KABC)
      > Replace with: DEFGH
      > Regular Exp.: checked
      > Tested against...
      > ABC to DEFGH if line KLM.
      > KLM to DEFGH if line ABC.
      > ABC to DEFGH if ABC line KLM.
      > ABC to DEFGH if line.
      > ABC ABC to DEFGH if line KLM.
      > DEFGH if ABC line KLM ABC.
      > KLM ABC to DEFGH if line KLM.
      > DEFGH if ABC line.
      > This is not the Clip Group -- but, certainly, you are better off with a simple clip like this (discounting further details like 'case', 'whole word' etc)...
      > ^!Jump Doc_Start
      > ^!Find "^.*?KLM.*$" RS
      > ^!IfError End
      > ^!Replace "ABC" >> "DEFGH" HAS
      > ^!Goto Skip_-3
      > Regards,
      > Flo
      > NT Pro 6.2 / NT Pro 7.0, Pre-release #8
    • Show all 9 messages in this topic