1 Reply Latest reply on Nov 7, 2012 12:42 AM by samar02

    GREP: finding a string not followed by another string

    samar02 Level 1

      (moved from "GREP: finding two identical consecutive strings")


      I am working on a "book" containing entries of the following nature:



      In this example (4th section), there are the abbreviations "1S", "2K", "Ri", "Jer", and "Gn" (twice). In the whole book, there are 39 such abbreviations in all, and what I should be able to do is find the same abbreviation occurring consecutively, like the second "Gn" instance above ("Gn 1714"), and delete it; as in this example, the two should be in the same paragraph, and they mustn't be separated by a semicolon.


      The important thing is that the search should not match if any of the other 39 abbreviations occurs in between, so if there is "1S ... 2K ... Ri ... 1S ...", the second occurrance of "1S" should not match.


      I was trying to do 39 different searches (this is not bad considering the size of the book), the first one dealing with the first abbreviation, the second with the second etc. Using GREP, how can I search for "abbreviation 1" not followed by "any of the abbreviations 2 to 39 or a semicolon" followed by "abbreviation 1"? Any hint is very appreciated!