Help in BBedit remove all text in brackets and brackets and a bold question (literally)

I just got BBedit and was wondering if you all could help me with 2 questions

I have interview transcriptions that have thoughts and reflections throughout. They’re in always in brackets [like this, I should have really not used these but oh well]. I want to remove the brackets and any text that’s in between brackets. I need to learn GREP, but would love some help.

In another sets of transcriptions, I used bold to distinguish between the interviewer and interviewee. The interviewer is in bold. Is there a way to add “I:” at the start of every bold line and “P:” in the front of every non-bolded line? I don’t think I can do this in BBedit since it doesn’t let you paste in formatted text. I wonder if Text Soap could do this?

This should work for the first issue: find and replace for

\[.*\] 

Note that there’s a trailing space after the closing square bracket to avoid inserting an extra space.

Re #2: What format are the files in? If they can be imported to docx or RTF (and others), Nisus Writer Pro can find and replace based on text attributes. If you have NWP you can f/r using the PowerFind Pro (regex) option, and you’d search for

.*
(in bold text)

replacing with

I: \0

to get the bold lines and then search for

(?:^.+$)
(NWP automatically inserts this complicated regex when you select WildCard > AnyParagraph from the gear menu in the f/r dialog)

and replace with

P: \0

to get the non-bolded lines

1 Like

I’ve never read it myself, but I keep hearing on podcasts lately that there’s a chapter in the BBEdit user manual on regular expressions that serves as a good introduction.

The BBEdit user manual is very good for regex, and if you want a bit more, I also recommend Beyond Code Paul Hudson, which has a great section on regex and some helpful exercises.

Thanks for these tips! I’ll check out NWP.

Also thanks all for the tips. It is indeed in the BBEdit manual (ch 8). I’ll be looking into that. I learned how to batch convert all my docx files to txt files which is fine for the ones where I had text to distinguish who was speaking. Not so great for the text where I used formatting to distinguish speakers (also not great idea in general).

I would recommend listening to Taming the Terminal episodes 17 and 18

2 Likes