Regex script sur plusieurs lignes

Bonjour à toutes et tous,

Je travaille sur le script du jeu vidéo GTA IV et n’arrive pas à me sortir d’affaire avec les regex.

Voici un extrait du script sur lequel je travaille (il faut remplacer les « _ » par des espaces mais ils disparaissent dans ma citation sur le forum) :

Dave Daddy’s back, you bitches… Daddy’s back, you bitches!
Niko Dave, come on. [knocking on door] Come on Dave.
Hossan Niko? What are you doing?
Niko Dave is not coming.
Hossan Ah, ignore him. Come on we got to get this thing ready before we dock.
[Hossan and Niko climb up a ladder to a higher deck.]
Hossan Let’s go. Here, pass me that. There. Whooh yeah! There she is…
______Liberty City.
Niko Yeah.
Hossan You ever been?
Niko No.
Hossan Crazy place, Niko.
Niko What you going to do?
Hossan I might come back on board… or I might try to make a go of it. Like
______ they say, it is the land of opportunity. I always wanted to make it
______ big… own a nice place, get a dog, a house… live the dream!
Niko Like my cousin.
Hossan Oh yeah?
Niko Yes - he’s got the lot - house, women, cars, parties… he writes me in
_____these wild emails, and after I got into trouble, I thought maybe uh…
_____and then I got this gig, and I spend the next seven months with you
_____fine people and I forget… After the war finished, I couldn’t get a
_____ job, nobody could… so I, uh, did some dumb things and got involved
_____ with some idiots…
J’aimerais récupérer dans un premier groupe le nom du locuteur et dans un second l’ensemble de ses paroles.

J’utilise pour le moment sur python la regex : r"(^[A-Z].+?)\s.+?([A-Z].+)"

Elle fonctionne parfaitement lorsque le dialogue est sur une ligne unique mais ne me permet pas de récupérer les dialogues sur plusieurs lignes (par exemple, la dernière intervention de Nico dans l’extrait que je vous ai joins). J’avoue que je sèche complètement pour récupérer cela … quelqu’un aurait une piste de réfléxion que je pourrai approfondir ?

Merci d’avance !

Bonjour,

Je vois plus du texte qu’un script.

Pas besoin de regex ou de python pour ça.

Text:

Niko Yes - he’s got the lot - house, women, cars, parties… he writes me in
_____these wild emails, and after I got into trouble, I thought maybe uh…
_____and then I got this gig, and I spend the next seven months with you


$ cat Text | tr '_' ' '

Niko Yes - he’s got the lot - house, women, cars, parties… he writes me in
     these wild emails, and after I got into trouble, I thought maybe uh…
     and then I got this gig, and I spend the next seven months with you

Petite note lexicale : on utilise également le mot « script » dans ce contexte…

Alternative en utilisant sed:

sed 's/_/ /g' -i Text

Note:
Le « -i » c’est pour opérer la modification directement dans le fichier. Sans ce « -i », ça te donnera un aperçu du résultat sans l’écrire dans le fichier d’origine.