Moving part of a field, an image, into another field via debug console

I’ve tried everything I possibly could to move an image(s) in one field to another.

Upon research, I have found out that moving audio is easy. I just have to paste this code into Debug Console. Of course, I changed the variables according to my needs.

theModel = mw.col.models.by_name(‘NoteTypeName’)
theNotes = mw.col.models.nids(theModel)
s = r’[sound:.*]’
for nid in theNotes:
note = mw.col.get_note(nid)
m =, note[‘Pronunciation’])
if (m):
note[‘TargetFieldName’] =
note[‘Pronunciation’] = re.sub(s, ‘’, note[‘Pronunciation’])

However, moving images does not seem to be as easy.

After doing more Googling, I found a person having the exact same problem, but it seems they also couldn’t find an answer.

What they (and I) tried in place of r’[sound:.*]’ in the code above:

r’<img .>’
r’<img .
r’<img src=".*>

So, my question is this:

How do I move “just” an image, not also other things such as audio or text, from one field to another, using Debug Console?

I will look forward to your response. Thank you for reading this post.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.