Anki Forums

TTS individual digits in num

Hi,

I have hundreds of cards with a num field that has 3 digits, like “269” that I created on Anki Desktop 2.1.45. I would like each digit read individually like “two six nine” via TTS, instead of “two hundred sixty nine”. I see there are some TTS options like “speed” [Ref: Anki Manual], but there’s no option that can be used to read the individual digits of a num. One hacky way I see of solving this is to do a deck-wide “Find and Replace” with backreferences and insert spaces between each number:

Find: ^(\d)(\d)(\d)$
Replace: ^\1 \2 \3$

…but Crate, which Anki uses for regex, doesn’t support backrefs.

I thought maybe a plugin might help, and saw this:
https://ankiweb.net/shared/info/1725433474

…but that’s only for tags (not any arbitrary field), and anyway the author states that “starting with version 2.1.45, vanilla Anki supports RegEx replacing for tags. Therefore this add-on will not be updated to work on versions newer than 2.1.44.”

Do you have any ideas for solving this problem?

Thank you :slight_smile:

Sorry if I’m asking something too obvious, but, why a simple search and replace doesn’t work?
Find: :“1”
Replace: "1 "
Find: :“2”
Replace: "2 "

1 Like

Try the following instead:
Replace: $1 $2 $3

2 Likes

@hkr Thanks, that worked! I didn’t think to try JavaScript-style backrefs…

Thanks, @cqg. You’re right, that would have worked too. I’m glad to see the JS-style backrefs work though, since I think that’s a lot more flexible.