Suggestions for a Regex QA check to avoid "double genitives" (particularly of ... of ...)

I'm currently retranslating a text that a non-translator colleague had partially translated, and I noticed an abundance of double genitives in both source text (DE) and target text (EN) (rendering of German "des/der ... des/der ..." formulations with "of ... of ...") and in wanting to understand more about Regex was wondering if there might be a quick and dirty Regex-based QA check that could be done to trap these kinds of double genitives.

Does anyone have any suggestions on this?

Parents Reply
  • Your question is interesting because it is also one of the examples in my book.
    You might want to refine the regex to match only occurrences of "of the" (and "of") near each other, such as
    \bof the(\s*\w+){0,2}\s+of the\b
    that finds "of the" separated by less than 3 "words". The bounds could be adapted to be less restrictive, but as Paul has often said consider "economy of accuracy" - how much effort do you want spend on refining your regex and how many false positives/negatives are you prepared to accept.

Children