Multiple Find and Replace

I have multiple cards with single letters before cloze deletions that I would like to fix with find and replace. I’m guessing with regex but I’m too inexperienced to figure out a solution. I want to move the single letters within the cloze deletions, and maintain the corresponding cloze indices (since I have studied many of them).

Some examples:

p{{c1::yridostigmine}} monotherapy should be avoided in those with m{{c2::yasthenic}} c{{c2::risis}} because the drug increases r{{c3::espiratory}} s{{c3::ecretions}}

Patients with WCT likely have S{{c1::VT with}} a{{c1::berrancy}} (due to preexisting or functional bundle branch block), a{{c2::ntidromic}} AV r{{c2::eentrant}} t{{c2::achycardia}}, or v{{c3::entricular}} t{{c3::achycardia (VT).}}

I would like to fix these to:

{{c1::pyridostigmine}} monotherapy should be avoided in those with {{c2::myasthenic}} {{c2::crisis}} because the drug increases {{c3::respiratory}} {{c3::secretions}}

Patients with WCT likely have {{c1::SVT with}} {{c1::aberrancy}} (due to preexisting or functional bundle branch block), {{c2::antidromic}} AV {{c2::reentrant}} {{c2::tachycardia}}, or {{c3::ventricular}} {{c3::tachycardia (VT).}}

Any help would be greatly appreciated. Thanks!

image

Find: ([^\s])\{\{c(\d+)::([^\}]*)\}\}
Replace with: {{c$2::$1$3}}

Copy the regular expression into https://regexr.com/ to see an explanation of the syntax.

4 Likes

You can use find and replace:

Find: \b\w{
Replace: {

Make sure to tick “Treat input as regular expression”

Limiting to particular fields is good practice if possible.

Edit: ninja’d!!!

3 Likes

That worked great, thank you!

1 Like