I need to match non parsed parts first, so I created regex that should catch them:
(?<inlinecode>!?\{\{\{(?<inline>.*?)\}\}\})|(?<inlinecode2>!?`(?<inline2>.*?)`)|(?<definition>^\s+((?:`[^`]*`|\{\{\{(?:}{,2}[^}])*?\}\}\}|[^`{:]|:[^:])+::)(?:\s+|$))
This part gets matched:
`test`
{{{test}}}
`{{{test`
{{{``test}}}
But this not (and it should):
{{{
test
}}}
{{{#!xxx
test
}}}
def::
some def
What am I missing. RegEx is almost the same as trac uses internally.
Your regex pattern is correct. You should just switch on "dot matches linebreak" modifier or put this (?:.|[\r\n])
instead of just .
(dot). Try this out:
(?<inlinecode>!?\{\{\{(?<inline>(?:.|[\r\n])*?)\}\}\})|(?<inlinecode2>!?`(?<inline2>(?:.|[\r\n])*?)`)|(?<definition>^\s+((?:`[^`]*`|\{\{\{(?:}{,2}[^}])*?\}\}\}|[^`{:]|:[^:])+::)(?:\s+|$))
Cheers.