How to replace html tags in note fields?

Some of my cards have the following text in some fields:

。<br>。

I want to replace it with

Find-replace dialogue doesn’t work either for the current selected cards or any other cards. Neither with regexps nor with plain text.

How can I make the replacement? (Whatever comes up in search doesn’t work).

Anki 24.11 (87ccd24e) (src)
Python 3.13.1 Qt 6.8.1 PyQt 6.8.0
Platform: Linux-6.12.7-zen1-1-zen-x86_64-with-glibc2.40

1 Like

From experiments I’ve found out that replace works only in the current card if HTML code is shown in the editor and the cursor is placed in a HTML code field. Then, replacement works only in this focused fields. Which is basically useless.

1 Like

I’ve never had a problem Searching or Find-and-Replace-ing on raw HTML. In fact, the HTML sometimes obscures what I’m really trying to find (e.g. formatting within a word).

  • Did you try your “Find” string as a Search first, to make sure it is locating the right notes?
  • Are you limiting your Find to “Selected notes only” and then forgetting to select the notes?
  • Are you limiting your Find to specific fields, and the text is in other fields?

No.

No.

Great. What about?

Yes, searching in browser works.

This catches my eye. When you have multiple cards/notes selected, the note editor closes. So if you can see that you have the field open, you only have that one card/note selected.

When you search up that set of notes/cards, select all of them, open Find and Replace, paste in that exact same search string as the “Find” and add whatever you want to replace it with, All Fields, limit it to selected notes only and ignore case (but don’t tick regex), and click OK – what does the pop-up in the corner say after that?
image

1 Like

The issue is likely minor differences between what’s being shown when editing, and the underlying code, e.g. <br> vs <br />. Exporting to a text file will reveal the text prior to any normalization caused by editing.

2 Likes

I had the exact same thing yesterday.

Try out this method: