How do I search for a word in a field that is next to the content of another field?

I would like to complete the following card search.

I need to search a deck for a word (word 1) which is in field 1, that is directly before (separated by a space) the content of field 2 (that is also in field 1). So I need to be able to search for word 1 in field 1 that is directly before (separated by a space) the content of field 2 (that is also in field 1).

For example:
Card 1
Field 1: The dog jumped over the lazy fox.
Field 2: dog

Card 2:
Field 1: The sparrow ate a worm
Field 2: sparrow

Card 3:
Field 1: The chicken ate an egg
Field 2: egg

I want to search a deck for all “the” that appear directly before the content of field 2 which in card 1 is “dog” and in card 2 is “sparrow”
So I need my search to find card 1 and 2 but not card 3 as card 3 “the” does not appear directly before the content of field 2 which is “egg”.

Does anybody know how I could do this?

Your help will be greatly appreciated!

Thank you!

I don’t think there’s a simple way to do that. You probably have to write a Python script: https://addon-docs.ankiweb.net/

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.