I understand that for a long time the |replace
filter has supported regex modifiers, but I can't seem to get the syntax right for multiline searches.
For example, here I want to extract the internal markup within a list that's been generated via Markdown, so I can do something with the internals:
{% set html = html|replace('/\\n/', '')|replace('/^(<ul>)(.*)(<\\/ul>)$/', '$2') %}
That works, but I should be able to use a modifier with the second replace so I don't have to use the first one, right?
But none of these work:
{% set html = html|replace('/^(<ul>)(.*)(<\\/ul>)$/m', '$2') %}
{% set html = html|replace('/^(<ul>)(.*)(<\\/ul>)$/\\m', '$2') %}
{% set html = html|replace('/^(<ul>)(.*)(<\\/ul>)$/(?m)', '$2') %}
What am I doing wrong?