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

**URL:** <https://forums.ankiweb.net/t/moving-part-of-a-field-an-image-into-another-field-via-debug-console/42955>\
**Category:** Development\
**Created:** [March 29, 2024, 5:42am UTC](https://forums.ankiweb.net/t/moving-part-of-a-field-an-image-into-another-field-via-debug-console/42955 "2024-03-29T05:42:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bana-nah](https://avatars.discourse-cdn.com/v4/letter/b/a183cd/32.png) [@Bana-nah](https://forums.ankiweb.net/u/Bana-nah)\
**Post date:** [March 29, 2024, 5:42am UTC](https://forums.ankiweb.net/t/moving-part-of-a-field-an-image-into-another-field-via-debug-console/42955/1 "2024-03-29T05:42:04Z")

</div>

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 = re.search(s, note[‘Pronunciation’])  
if (m):  
note[‘TargetFieldName’] = m.group(0)  
note[‘Pronunciation’] = re.sub(s, ‘’, note[‘Pronunciation’])  
note.flush()

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [April 28, 2024, 5:42am UTC](https://forums.ankiweb.net/t/moving-part-of-a-field-an-image-into-another-field-via-debug-console/42955/2 "2024-04-28T05:42:15Z")

</div>

Closed on April 28, 2024, 5:42am UTC

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