embedmd icon indicating copy to clipboard operation
embedmd copied to clipboard

Regexp flags or \S,\s commands

Open chrispahm opened this issue 6 years ago • 1 comments

Hey there, thanks for the awesome repo! I'm trying to match a codeblock that looks like this

equation_(a,b,c,d)
    $ (some_condition
     $ (some_other_condition)) ..

My start regex to match the equation looks like this (?s)equation_.*?\.\., so it's effectively using the single line flag. However, it looks like embedmd does not support this kind of flags. My other thought was to substitute these flags by something like equation_[\S\s]*?\.\. , but then embedmd also throws an error saying \S was not escaped.

Does anyone have a recommendation for me? Thanks in advance!

chrispahm avatar Jun 08 '18 12:06 chrispahm

Alright, looks like the restrictions of POSIX ERE were not allowing the [\S\s] notation. I forked the repo and changed the regexp.CompilePosix to regexp.Compile. Also, absolute file paths can be consumed by embedmd in that version. I could do a PR, however I guess it would be better to keep using the POSIX regexp and just use the regular compile function with a certain flag. The repo can be found here

chrispahm avatar Jul 03 '18 09:07 chrispahm