Editor: batch replace in one field, also with regex [Official thread]

Thank you for your reply!

Come to think of it though (and despite my question), considering the way the add-on is currently set up, I think it makes more sense to let both run at the same time.

What would be great however, is if the user could save and load sets of replacements. Then, both the regular and the regex replacements could be integrated into the same window, with an additional checkbox specifying whether the replacements of that set should be interpreted as a regular or a regex replacement. That way, if a user wanted to perform different replacements, he could simply load a different set. I realize though, that it would probably require a lot of work to implement this and maybe more than you quite understandably can or want to devote.

that’s a feature I like but it would require too much time.

Excellent Add-On!
However, I have a problem that I don’t think it could be tackled on a card to card basis. A deck of mine is consisted of over 9000 cards and I’d like to use the regex replacement your addon provides but to a specific field to all 9000 cards at the same time. I know that there’s the Find and Replace option in anki as a default option but this doesn’t let me to replace the regex inside a field. (it techinically does but for some specific reason an expression like this: ([ぁ-んー])\s+([ぁ-んー]) to be replaced with this \1\2 gives me a parse error. In particular parse error: look-around, including look-ahead and look-behind, is not supported. Could you please make this a deck for me??? Thank you for everything!!! :slight_smile:

P.S.: I also tried using Notepad++ to change this field but things got messy…

@japanese_enthusiast : I can’t help with that. My add-on is only about one field. You’d need code that iterates over all fields in your collection.

using an exported text/csv file and edit it sounds like the best solution for someone who doesn’t know anki internals or python. Maybe work on your regex with chatgpt or site like regex101.com ?

If you are willing to spend some some money you could hire a coder who writes some lines of python that you can run in the anki debug console ? Maybe ask someone like @abdo who has contributed to anki itself and published several anki addons and who can be hired at https://www.fiverr.com/abd_nh

Hi! The add-on seems to need some small update to make it fully compatible with 23.10+.

Currently, the add-on does work as intended, but it won’t allow you to open the ‘configuration’ menu to customize the replacements.

This looks like it is caused by line 47 of the config_window.py file, which does not get along well with the new versioning scheme:
ANKI_VER_21 = version.startswith("2.1.")

Changing it to something like:
ANKI_VER_21 = version.startswith("2.1.") or (version.startswith("2") and version[1].isdigit())
seems to fix the problem.

thanks for notifying me about this problem and mentioning a way to fix it. I’ve just uploaded a new version to ankiweb. If you run into problems let me know.