Obsidian to Anki has one of the most horrifying regex setup I have seen.
It involves the idea of capturing a whole segment of text that will be used for flashcard, then regexing inside it for questions (first capture group) and answers (second capture group).
Examples:
^(.*[^n:]{1}):{2}([^n:]{1}.*)
(RemNote single line style)
^Q: ((?:.+n)*)n*A: (.+(?:n(?:^.{1,3}$|^.{4}(?<!<!--).*))*)
(Question answer style)
I want to do this for a bunch of notes that are setup with a lot of callouts, they look like this:
> [!PDF|] [[James W. Kurose, Keith W. Ross - Computer Networking.pdf#page=296&selection=32,0,33,25|James W. Kurose, Keith W. Ross - Computer Networking, p.296]]
>
> > Describe why an application developer might choose to run an application over UDP rather than TCP.
>
> An application developer may not want its application to use TCP’s congestion control, which can throttle the application’s sending rate at times of congestion. Often, designers of IP blah blah.
I want to capture ALL lines starting with > >
as question and ALL lines starting with >
as answer. First and second capture groups in regex, specifically. Only it seems the presence of > in first and second capture group causes a mess because regex barely has negative matching?
I tried a lot of things including [^ >]
after first capture group and (?! >)
but it doesn’t seem to work.