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

From the tag "PLAC" in Gedcom, How to extract only the value "Town" or "Area code" for a label

0 votes

Hello

This is a part of my Gedcom files - the section @XX@ INDI
-----------------------------------------
0 @1I@ INDI
1 NAME Eugénie Joséph/Lef/
2 GIVN Eugénie Joséph
2 SURN Lef
1 SEX F
1 BIRT
2 DATE 27 SEP 1856
 2 PLAC Paris,75000,Paris,Île-de-France,FRANCE,5 eme arrondissement
2 _FNA YES
....
....

0 @2I@ INDI
....
...
-----------------------------------------
As you will see in this example the tag "BIRT" "PLAC" has in the order "Town", the "Area code", "County" and so .. with separator "comas"

 1 BIRT
2 PLAC Town , Area code , County , Region , Country, Subdivision

I can't extract the field "BIRT "Town" or "Area code" with the parameter ""(?ms).*\d\s\PLAC\s(.*)$"
This parameters extract the whole line "Town , Area code , County , Region , Country, Subdivision", but not only "Area code" in the label
I try others code .. but I can't reached success... Maybe I am wrong when I type the Pattern ?
I read <https://yed.yworks.com/support/qa/10304> I Read - <https://yed.yworks.com/support/qa/14276> I Read - <https://yed.yworks.com/support/qa/12169>

 Question 1 – From the tag PLAC in gedcom, How to extract only the value "Town" or "Area code" for a label in a node of the family tree ?

 Best regards

in Help by (180 points)
recategorized by

1 Answer

0 votes

The regular expression (?ms).*^\d\sPLAC\s(.*)$ means "for a line that starts with a number, a whitespace, the text "PLAC", and an additional whitespace, extract the rest of the line".
What you want is "for a line that starts with a number, a whitespace, the text "PLAC", and an additional whitespace, extract the text after the i-th and before the next comma.".

E.g. try
(?ms).*^\d\sPLAC\s([^,]*),.*$
to extract town,
(?ms).*^\d\sPLAC\s[^,]*,([^,]*),.*$
to extract area code, etc.

This is really not a yEd problem, but rather a regular expression problem. Please see the Java 8 Pattern documentation for information on the supported regular expression syntax.

by [yWorks] (130k points)
Hello,
You are right this is not concerning Yed but Regex,
Thank for your help

Sorry for the disturb
Best regards
Legal Disclosure | Privacy Policy
...