Obsidian_to_Anki
Obsidian_to_Anki copied to clipboard
Custom syntax request
I want use the unorder list as flashcard, for example
-
Question1
- Answer1
- Answer2
-
Question2
- Answer1
To avoid all unorder list be converted to flashcard, * won't convert to flashcard
- Normal list
- Normal content
content
- Question1
- Answer
- Question2
- Answer
Solved! Use the regex below ( Basic card )
^\- ((?:.+\n)*?)\n*[\t ]+((\- )?.+(?:\n(?:^.{4}(?<!<!--)(?<!\- ..).*))*)(?:\n^$)?
Usage:
- Single Line
- Question1
- Answer
- Question2
- list root
- Answer part 1
- Answer part 2
- Nested Answer
- Question3
- Answer
It will stop scan answer when there is a empty line
Result

your original md change to
- Single Line
- Question1
- Answer
<!--ID: 1610044657875-->
- Question2
- list root
- Answer part 1
- Answer part 2
- Nested Answer
<!--ID: 1610044657886-->
- Question3
- Answer
<!--ID: 1610044657897-->
It will stop scan answer when there is an empty line
I often use * instead of - for unorder list, except todo box - [ ] (which will be converted to flashcard too)
Hi there, you seem to be familiar with regex. I have a quite simple question, but cant find the solution in the wiki: I use the "Question answer style" and i would like to add my Anki field "Extra" (with an example senetence) for example Q: Money A: Geld Tags: english So how can be more anki fields implemented in the regex styles?
Each additional field would require a new capture group. I was a complete regex beginner yesterday, but I was able to hack up an expression for my use case through trial and error. Check out regexr.com. It helps you understand exactly what is happening in a regex. Google is also your best friend. If all else fails, try posting on reddit.com/r/regex. The community is quite responsive. Good luck!
According to the use of regex: I get the general idea. But dont get the concept within obsidian_to_anki. Perhaps you have the time to answer some questions? 🙏 This is the Question/Answer regex: '''^Q: ((?:.+\n))\nA: (.+(?:\n(?:^.{1,3}$|^.{4}(?<!<!--).)))''' How is the connection between the anki fields and the regex parts build? Via counting? First regex group -> First anki field? Second regex group -> Second anki field? But then why is there a 3 and 4 in the regex with only 2 fields used? That would mean that i change the order of my fields in anki the cards would be messed up, right? Would be great to hear from you.