Identifying with regexes and Python the title of a particular paragraph containing an unique word (and French Judges)
I'm doing some data analysis over the judge appointment system in France, and using some code to do so. But I've run into a regex problem.

My data, is made of a big list of courts and judges appointments. 

Here's an example list :

> Appellate Court of Paris
> 
> Blabla about the jugdge : Mr Dominique Martin, blahblahblah Blabla
> about the judge : Ms Jeanne Truc
> 
> District Court of Paris
> 
> Blabla about the jugdge : Mr François Dupont, blahblahblah Blabla
> about the jugdge : Mr Jean Dupuis, blahblahblah Blabla about the
> jugdge : Ms Marguerite Lorem, blahblahblah
> 
> District Court of Lyon
> 
> Blabla about the judge : Ms Lorena Ipsum, blablabh

And there a big lot of these, district and appellate courts mingled. Usually, after a city appellate court, comes the district one.

(*For the french guys reading this, I'm translating "Tribunal de grande instance" to "District Court" and "Cour d'appel" to "Appellate Court" it's easier to understand if everything is in English*)
 

And then I need a list of the judges by the courts their in.

To achieve that, I started doing a regex using good ol' python 3. First I get a list of all the judges thanks to the Mr and Mrs (well it's french so M. and Mme. ). And then, iterating over each judge in this list to find where the hell their being appointed. I wrote something like that :  

    court = re.findall(r'(District Court of.+?|Appelate Court of.+?)\n.+?'+ judge, appointments, re.S)

The "judge" var is then the name of the current judge I'm seeking and "appointments" the list I'm regexing on. Dotall flag is on, and if you don't know python, forget about the 'r' before the pattern, it's just about how to interpret special chars in the string following. 

(I've also tried using re.search, but i think re.findall is better for spotting bugs)

And the result is always the first one in the list (for instance : Appellate Court of Paris)... just as if it was working as a greedy request, even if I flagged every quatifier with the '?' that in python identifies the quantifier as non-greedy.

(I'm a law student, not a CS one, I beg for forgiveness if I'm doing something utterly wrong there). 

Note: The original list i'm parsing : http://www.legifrance.gouv.fr/affichTexte.do?cidTexte=JORFTEXT000022472292 (BEWARE that's an UGLY french government website). 
Identifying with regexes and Python the title of a particular paragraph containing an unique word (and French Judges)
===

I'm doing some data analysis over the judge appointment system in France, and using some code to do so. But I've run into a regex problem.

My data, is made of a big list of courts and judges appointments. 

Here's an example list :

> Appellate Court of Paris
> 
> Blabla about the jugdge : Mr Dominique Martin, blahblahblah Blabla
> about the judge : Ms Jeanne Truc
> 
> District Court of Paris
> 
> Blabla about the jugdge : Mr François Dupont, blahblahblah Blabla
> about the jugdge : Mr Jean Dupuis, blahblahblah Blabla about the
> jugdge : Ms Marguerite Lorem, blahblahblah
> 
> District Court of Lyon
> 
> Blabla about the judge : Ms Lorena Ipsum, blablabh

And there a big lot of these, district and appellate courts mingled. Usually, after a city appellate court, comes the district one.

(*For the french guys reading this, I'm translating "Tribunal de grande instance" to "District Court" and "Cour d'appel" to "Appellate Court" it's easier to understand if everything is in English*)
 

And then I need a list of the judges by the courts their in.

To achieve that, I started doing a regex using good ol' python 3. First I get a list of all the judges thanks to the Mr and Mrs (well it's french so M. and Mme. ). And then, iterating over each judge in this list to find where the hell their being appointed. I wrote something like that :  

    court = re.findall(r'(District Court of.+?|Appelate Court of.+?)\n.+?'+ judge, appointments, re.S)

The "judge" var is then the name of the current judge I'm seeking and "appointments" the list I'm regexing on. Dotall flag is on, and if you don't know python, forget about the 'r' before the pattern, it's just about how to interpret special chars in the string following. 

(I've also tried using re.search, but i think re.findall is better for spotting bugs)

And the result is always the first one in the list (for instance : Appellate Court of Paris)... just as if it was working as a greedy request, even if I flagged every quatifier with the '?' that in python identifies the quantifier as non-greedy.

(I'm a law student, not a CS one, I beg for forgiveness if I'm doing something utterly wrong there). 

Note: The original list i'm parsing : http://www.legifrance.gouv.fr/affichTexte.do?cidTexte=JORFTEXT000022472292 (BEWARE that's an UGLY french government website). 