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

22146A little help on look behinds

Expand Messages
  • John Shotsky
    Oct 6, 2011
    • 0 Attachment
      I always have trouble making these things work.

      I enclose groups of text with [[[[group of text]]]] with up to thousands of instances. The very first one may be missing
      the [[[ part. That's the only one.

      I want to delete the ]]] that is not preceded by a [[[ + a group of text that exists. It can always be found as
      happening after the start of the file (/A) and before any [[[. I apparently don't know how to apply multiline to a look
      behind to detect this situation.

      An example:

      This is the first line in the file.

      This is the second line in the file.

      ]]] this is the line I want removed.

      [[[ this is a valid line
      any number of lines here are valid lines
      ]]] this is a valid line.

      The only one to remove is the first one.

      Any ideas? This has me stumped. I know how to do it the hard way, by permitting sentences that don't start with ] after
      the file beginning, but I know there is a better way. Besides, I don't always know how many lines may exist between the
      top of the file and the first ]]] that is not preceded by a [[[.

      Thanks,
      John
    • Show all 21 messages in this topic