I'm trying to create a macro to bulk edit documents. I have two key things I need to accomplish with a find and replace.

First is removing everything BEFORE the first instance of a speaker tag:

_Transcription details:_

  ------------------- ---------------------

  Date:     05-Dec-2016

  Input sound file: UKCHBOSTX021201.m4a

  ------------------- ---------------------

_Transcription results:_

  ---------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  TEACHER: Who can tell me the topic we have been doing this week and last week?

This first speaker could either be STUDENT: or TEACHER: and will not be anything else. I can't seem to get any find and replace to work without removing everything before the LAST instance of this as opposed to the FIRST.

The second is that I need all STUDENT: dialogue removed:

TEACHER: Who can tell me the topic we have been doing this week and last week? 

  STUDENT: [inaudible]

  TEACHER: 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84. Let's go backwards.

  STUDENT: 84, 77, 70, 63 6, 49, 42, 35, 28, 21, 40, 7, 0.

Again, I seem to only be able to remove everything between the FIRST instance o STUDENT: and the LAST paragraph break using the following

FIND: STUDENT:(.*)\r\n

Clearly I'm missing something. My knowledge of regex is very limited and I'm not a programmer of any kind.

Is anyone able to shed some light?

  • This can be achieved easily by C/C++ (fstream) ....but unfortunately you don't know... Dec 6, 2016 at 4:08
  • Okay I worked out how to remove student dialogue using '[^\r\n]{1,200}', but I'm very much struggling with the first problem.
    – Cherie
    Dec 6, 2016 at 5:01

1 Answer 1


To delete from the beginning up to the first TEACHER:or STUDENT: Position the cursor with CTRL+HOME, open replace CTRL+H
Search: ^.*(TEACHER:|STUDENT:)
radiobutton: Regular Expression
Mark Checkbox find \r and \n

  • Perhaps I'm doing something wrong? It seems to think it's replacing something (355 occurrences were replaced) but everything from -Transcription details:_ to TEACHER: is still there.
    – Cherie
    Dec 6, 2016 at 6:35
  • Maybe. With your test text it works here. Having a different language Version I can't explain better.
    – LotPings
    Dec 6, 2016 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .