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

22143RegEx multiple find over hard line breaks

Expand Messages
  • Mike Lenahan
    Apr 19 10:04 PM
      O wise ones
      I am having a bit of a problem getting my head around RegEx not having used Perl or anything similar in the past so please don't laugh when I ask some silly questions.

      I have some text files (60M) and have to find and delete certain portions of the text between two patterns of text, which might involve chars such as ÀÊ.

      The two patterns have an unknown number of characters (including hard returns) between them. I can find and delete the text between using something like:

      ^!Replace "string1.+\R(?=\R).+?string2" >> "" AWRS

      but if the two strings go over an unknown number of hard returns then I can't get the between text.

      I have tried playing about with the {0,} but can't seem to get it working. The last effort is

      ^!find "string1.+(.+|\r\n|\n|\r)(?1){0,}string2" CIWRS

      Which, I thought would match string1 followed by multiple chars (up to a line end) OR hard return (\r\n) OR newline (\n) OR return (\r) repeated 0 or more times then string2.

      What am I missing / doing wrong?

      Regards

      Mike
    • Show all 5 messages in this topic