S.s
S.s

Reputation: 1

How to match every followed by colon punctuation in Komodo?

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.

Upvotes: 0

Views: 84

Answers (2)

zx485
zx485

Reputation: 29022

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.

Upvotes: 0

mukesh210
mukesh210

Reputation: 2892

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.

Upvotes: 0

Related Questions