To be confident in these fixes, we would really need to adapt the https://github.com/eXist-db/exist-markdown/blob/master/test.md file into proper unit tests. I believe there are still problems in the parsing of inline HTML. Preparing per-feature tests would help narrow that problem down and confirm that any/all covered markdown features work as expected.
The approach taken here was to adjust the flags for regular expressions functions. See https://www.w3.org/TR/xpath-functions-31/#flags.
My guess about the source of the problems is that https://github.com/eXist-db/exist/pull/3530 introduced subtle changes to the handling of flags.
To be confident in these fixes, we would really need to adapt the https://github.com/eXist-db/exist-markdown/blob/master/test.md file into proper unit tests. I believe there are still problems in the parsing of inline HTML. Preparing per-feature tests would help narrow that problem down and confirm that any/all covered markdown features work as expected.