This will match level 2 OBJE tags and all subtags: \n2 OBJE.(\n[3-9].)* This will match level 3 OBJE tags and all subtags: \n3 OBJE.(\n[4-9].)* Source: https://www.webtrees.net/index.php/en/forum/help-for-release-2-1-x/37650-import-gedcom-without-obje#97068