Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

Build a pattern for Properties Mapper

0 votes
Hello,
I have difficulties for build a pattern Regex.. I forgot my lessons  ...

This is an example of my Gedcom files
0 HEAD
1 ......
1 CHAR UTF-8
1 PLAC
2 FORM Town , Area code , County , Region , Country, Subdivision
0 @1I@ INDI
1 NAME Eugénie Joséphine/Lefeuvre/
2 GIVN Eugénie Joséphine
2 SURN Lefeuvre
1 SEX F
.....
1 BIRT
2 DATE 30 JUL 1860
3 TIME 1:0
2 PLAC Bayonne,64100,Pyrénées-Atlantiques,Aquitaine,FRANCE,Pyrénées Atlantiques
2 _FNA NO
2 SOUR @8S@
2 NOTE Témoins :
3 CONT Jean Baptiste
3......
0 @4U@ FAM
1 HUSB @2I@
1 WIFE @1I@
1 CHIL @3I@
1 MARR
2 DATE 6 OCT 1883
3 TIME 11:0
2 PLAC Saint-Maur-des-Fossés,94210,Val-de-Marne,Île-de-France,FRANCE,
2......

Q1 - How to Extract the <Date> from tag <MARR> sub-tag <DATE> ?
Q2 - How to Extract the sub-tag <Town> and the sub-tag <Country> from tag <MARR> sub-tag <PLAC> and build <Town - Country>  <Town> + caracter "-" + <Country> ?
Sometimes <MARR> <PLAC>
    doesn't exist,
    is partially empty i.e. < , Area code , County , Region , Country, Subdivision>
    is partialy empty i.e. <Town ,   , County , Region , Country, Subdivision>
    and so ..
   
Thanks in advance for your help
Regards
in Help by

1 Answer

0 votes

A1

This works very much as described in Place of birth in Family Tree Layout from GEDCOM PLAC data:
(?ms).*^\d\sDATE\s(.*)$

A2

Unfortunately, this is not really supported. Processing "irregular" data requires additional logic that is beyond the scope of yEd's properties mapper and regular expressions in general.
Your best bet is to "sanitize" (i.e. make sure <PLACE> always exists and its data is always "well-formed") your data before processing it in yEd.

by [yWorks] (130k points)
Hello,
I am Sorry, but I think you are wrong ..
I want to extract the subtag <DATE> in the tag <MARR>, ie; <6 OCT 1883> in this example

1 SEX F
.....
1 BIRT
2 DATE 30 JUL 1860
3 TIME 1:0
2 PLAC Bayonne,64100,Pyrénées-Atlantiques,Aquitaine,FRANCE,Pyrénées Atlantiques
2 _FNA NO
2 SOUR @8S@
2 NOTE Témoins :
3 CONT Jean Baptiste
3......
0 @4U@ FAM
1 HUSB @2I@
1 WIFE @1I@
1 CHIL @3I@
1 MARR
2 DATE 6 OCT 1883
3 TIME 11:0
2 PLAC Saint-Maur-des-Fossés,94210,Val-de-Marne,Île-de-France,FRANCE,
2......

1- In <MARR>, your pattern <(?ms).*^\d\sDATE\s(.*)$> + <$1> extract :
"
6 OCT 1883
3 TIME 11:0
2 PLAC Saint-Maur-des-Fossés,94210,Val-de-Marne,Île-de-France,FRANCE,
2 _FNA NO
2 SOUR @10S@
2 NOTE Témoins
Achille Dubois, oncle de Georges, 65 ans, employé au gaz, domicilié 20 rue Clavel à  Paris 19 ieme.
Ma (?), Viviez 34 ans, commercant domicilié 34 rue de Moscou à  Paris 8 ieme."

2- In <MARR>,my pattern <(?ms).*^\d\sDATE\s([^,]*),.*$> + <$1> extract :
"
"6 OCT 1883
3 TIME 11:0
2 PLAC Saint-Maur-des-Fossés"

So, all of these patterns doesn't run fine

The test, of the Regex in a Regtester seems OK, so where is the error ?

Regards

Well, try
(?ms).*^\d\sDATE\s(.*?)$.*

You have to keep in mind that yEd's properties mapper performs "regular expression replacement". If the expression matches only a part of the input data, the unmatched part will remain unchanged.

Hello,

Finaly, I wrote these Regex pattern for extract :

<MARR-DATE>                        <(?ms).*^\d\sDATE\s([^\r\n]*).*$>
                       
<MARR-PLAC-Town>                <(?ms).*^\d\sPLAC\s([^,]*),.*$>

<BIRT-or-DEAT-PLAC-Area Code>    <(?ms).*^\d\sPLAC\s[^,]*,([^,]*),.*$>

<BIRT-or-DEAT-PLAC-Country>        <(?ms).*^\d\sPLAC\s[^,]*,([^,]*),([^,]*),([^,]*),([^,]*),.*$>
                                or better
                                <(?ms).*^\d\sPLAC\s(?:[^\,]*\,){4}([^,]*).*$>
   
It seems working.
Q1 - Do you feel there are correct ?

<<BIRT-or-DEAT-PLAC-Town+Country>    you are right .. it seems impossible

Thanck you very much for your help
Best regards
Legal Disclosure | Privacy Policy
...