如何在Komodo中匹配每个随后的结肠标点符号?

时间:2018-12-14 02:18:24

标签: regex match komodoedit

在对话(电影脚本)文本文件中,我必须匹配句子开头的所有名称,后跟冒号:。如何使用Komodo做到这一点?

以下是示例文本:

  

马丁:让我们告诉胡珀先生,我们,十六进制。这里。桶匠:啊,被确定为克里斯汀·沃特金斯的受害者。女高加索人。马丁:是的,现在,这里就是那里。桶匠:可能划船事故。马丁:是的。桶匠:受害人的身高和体重只能从部分遗骸中估算出来。躯干已在胸中部被切断。没有主要器官。

2 个答案:

答案 0 :(得分:0)

以下正则表达式将找出所有以:结尾的名称。

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

无论对话是在单独的行上还是全部在一行上,它都可以在两种情况下工作。

尝试在https://regex101.com处使用正则表达式。

答案 1 :(得分:0)

我尚未使用Komodo对其进行测试,但是您可以使用Unix / Linux sed命令RegEx将扬声器的输出分开

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

其输出是:

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.