Regex Help, Obsidian to anki plugin

Guys, im using that regex: ((?:.+\n)(?:.{.)(?:\n(?:^.{1,3}$|^.{4}(?<!<!–).))*) for cloze types notes in the obsidian to anki settings, but it is taking the entire bullet list instead of the single bullet. Any tips to help only take the single bullet ?

Current situation:

  • test1
  • test2{anki here} test
  • test3
    <— anki takes the entire bullet list —>

Desired situation:

  • test1
  • test2{anki here} test
    <— anki takes just that bullet —>
  • test3

Can you explain what you aim to hit with that regex? It’s a mix and match targeting line shifts, and start and end of lines in combination with random sequences of any character, so I’m not surprised it matches more than expected.

So please describe in more details what you want out of it.

In addition, using something like regex101.com can be very helpful when working with regex, since you can provide test cases, and it also shows which part of your regex matches what, and it gives explanations (to some degree) of your regex.

hey holroy, thanks for the answer,
im looking to implement this: Cloze Paragraph style · Pseudonium/Obsidian_to_Anki Wiki · GitHub
and its working as expected, but it is taking the entire bullet list, instead of the single bullet.
Would like to Regex recognize to stop when line jumps to maybe it works with a single bullet

solve with that: ((?:.+\n)\n(?:.{.)(?:\n\n(?:^.{1,3}$|^.{4}(?<!<!–).))*)

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