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

22155Re: [Clip] A little help on look behinds

Expand Messages
  • flo.gehrke
    Oct 16, 2011
      --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
      > ...there may be, at most, one instance where ]]] is not
      > preceded anywhere in the file by a [[[. That is the only ]]] that
      > should be removed. It is always the first one...


      I think if it's always the first ']]]' in the string you could just write...

      ^!Replace "(?s).{1,}?\K\]{3}\R" >> "" WRS

      The beginning of file is asserted with the 'W' option -- so there's no '\A' necessary. Without the 'A' option, only the first occurrence gets removed.

      If "no instances of ([[[) [is] permitted in search" you could exclude that with a negative Lookahead...

      ^!Replace "(?s)(?!\[{3}).{1,}?\K\]{3}\R" >> "" WRS

      ...if necessary.

    • Show all 21 messages in this topic