I am trying to create a regex to find and replace (keep empty) different names in an txt file. I use Komodo, as it is part of the examen.
Here the text sample:
*Cassidy: What's your name again?
Chrissie Watkins: Chrissie!
Cassidy: Where are we going?
Chrissie: Swimming!
Cassidy: Slow up, slow down! I'm not drunk! Slow down! Wait I'm coming! I'm
coming! I'm definitely
coming! Wait, slow up! I can swim -- just can't walk or dress myself.
Chrissie: Come on in the water!
Cassidy: Take it easy. Take it easy.
Chrissie: Oh! God help me! God! Argh! God help!
Cassidy: I'm coming... I'm coming.
Chrissie: It hurts! It hurts! Oh my god! God help me! God please help!
Martin Brody: How come the sun didn't use to shine in here.
Ellen Brody: We bought the house in the fall, this is summer.
Ellen: Somebody feed the dogs, huh?
Martin: Right.
Ellen: See the kids?
Martin: They must be in the backyard.
Ellen: In Amity, you say: yahd.
The text must be cleaned up, meaning all names at the beginning of each line must be deleted (replaced by nothing).
If I use this: \w.¨:
Also names in texts (not the person speaking) are gone / deleted.
Is it possible to use just one regular expression for cleaning up?
You may use
See the regex demo
Details
(?m)-re.Mflag, it makes^match start of a line^- start of a line\*?- an optional*char[A-Z]- an uppercase letter[\w' -]*- 0 or more word chars, spaces,-or apostrophes:- a colon\s*- 0+ whitespaces.