0

In a dialogue (movie script) text file I have to match all the names at the beginning of a sentence followed by the colon punctuation :. How do I do this using Komodo?

Here is a sample text:

Martin: Let's show Mr. Hooper our, uh, hex. Here. Hooper: Ah, victim identified as Christine Watkins. Female Caucasian. Martin: Yeah now, now here's where we have it. Hooper: Probable boating accident. Martin: Yeah. Hooper: The height and weight of the victim can only be estimated from the partial remains. The torso has been severed in mid-thorax. There are no major organs remai.

zx485
  • 28,498
  • 28
  • 50
  • 59
S.s
  • 1
  • Please add sample text. – Tim Biegeleisen Dec 14 '18 at 02:20
  • so this is a part f the text below: Normally every line starts with a name (it's a dialogue) – S.s Dec 14 '18 at 19:12
  • Martin: Let's show Mr. Hooper our, uh, hex. Here. Hooper: Ah, victim identified as Christine Watkins. Female Caucasian. Martin: Yeah now, now here's where we have it. Hooper: Probable boating accident. Martin: Yeah. Hooper: The height and weight of the victim can only be estimated from the partial remains. The torso has been severed in mid-thorax. There are no major organs remai.. – S.s Dec 14 '18 at 19:12
  • Should your sample have line breaks in it? Presently the search you want only would match "Martin", since there is only one line here. – halfer Jan 12 '19 at 12:03

2 Answers2

0

Following regex will find out all names which have : after them.

\s?(\w+)(?=:)

No matter if dialogues are on seperate lines or they all are on single lines, it will work in both scenarios.

Try above regex at https://regex101.com.

mukesh210
  • 2,792
  • 2
  • 19
  • 41
0

I haven't tested it with Komodo, but you can separate the output by speakers with the Unix/Linux sed command RegEx

sed -e "s/\(\w\+\):/\\n\1:/g" text.txt

Its output is:

Martin: Let's show Mr. Hooper our, uh, hex. Here. 
Hooper: Ah, victim identified as Christine Watkins. Female Caucasian. 
Martin: Yeah now, now here's where we have it. 
Hooper: Probable boating accident. 
Martin: Yeah. 
Hooper: The height and weight of the victim can only be estimated from the partial remains. The torso has been severed in mid-thorax. There are no major organs remai.
zx485
  • 28,498
  • 28
  • 50
  • 59