matthayes / anki_cloze_anything

Add cloze deletions to any existing Anki notes without any modification to Anki
https://ankiweb.net/shared/info/330680661
Apache License 2.0
54 stars 12 forks source link

Cloze not working with multiple example with numbers inside #1

Closed lucamolteni closed 4 years ago

lucamolteni commented 4 years ago

According to documentation

Note: You can have more than one field with cloze content per note. For example, you could have fields Example1Cloze and Example2Cloze. Each can be used to generate cards.

But this regexp /^[^\d]+(\d+)$/ Will match the first number and use it for the field.

By using

ExampleFirstCloze
ExampleFirstCloze1
ExampleFirstCloze2

and

ExampleSecondCloze
ExampleSecondCloze1
ExampleSecondCloze2

This works accordingly

matthayes commented 4 years ago

Ah thanks for pointing this out. I intended for the regex to match the last number in the field name but currently it doesn't allow numbers within the field. I'll update the documentation and improve the regex separately.

matthayes commented 4 years ago

Template fixed in https://github.com/matthayes/anki_cloze_anything/commit/1ffae38b0baf1c67c62acbe2d39092559b21ee98