0

I'm trying to do a custom markdown notation and I need the inner most markdown every time, At the moment I have only 2 markdowns for testing purposes _ and *

Regex: (?<![_\*])(?<!\\)\*(?![_\*])(([^\*]|\\\*)*)(?<![_\*])(?<!\\)\* for capturing the inner most *

Examples:

  1. Should capture: *test1\*test2* - Captures!
  2. Should capture: _*test1\*test2*_ - but doesn't Capture because of the next rule.
  3. Shouldn't capture: *_test1\*test2_* some random text * - Doesn't Capture *_test1\*test2_* and captures * some random text * but I want to ignore this capture.

If I remove my first look before (?<![_\*]) works for 1 and 2, but captures the last * from the text until the next one because the beginning * is from from the previous text which should be ignored

Jason Aller
  • 3,475
  • 28
  • 40
  • 37
T. Razvan
  • 1
  • 2

0 Answers0