Conditional card generation based on the content of field

I have a custom note type with 2 fields:

  1. Word
  2. IPA

IPA is a phonetic transcription of the word.
For example,
Word: man
IPA: mæn

Now i want to generate a card only if the pronunciation contains one of certain sounds, such as “æ”.
The card would look like:
Q: man / m[.]n /
A: æ
Basically it would be a cloze deletion for that specific sound. However I do not want to make the cloze deletions manually. I want to generate them automatically using Javascript from the data I already have in the fields “Word” and “IPA”.
The only problem is that if the IPA does not contain the specific sound, the card would be empty. So i would like those empty cards not to be generated.

One way it could be implemented is to allow using regular expressions in the conditional card generation:
{{#re:IPA:æ}}

{{/re:IPA}}

1 Like