I have two versions of the word hi
.
(defvar x "```hi```")
(defvar y "```
hi
```")
I also have a regex scanner:
(defvar scanner (cl-ppcre:create-scanner "```(.*?)```" :multi-line-mode t))
When I regex-replace on x, it returns as it should. but the multi-line-mode
doesn't seem to work.
(cl-ppcre:regex-replace scanner x "\\1") ;; => "hi"
(cl-ppcre:regex-replace scanner y "\\1") ;; => "```
hi
```"
I want everything between "```" to be replaced, irrespective of how many lines the string is.
What am I doing wrong?
You need
(create-scanner ... :multi-line-mode t :single-line-mode t)
Yes, this is insane. But it's equivalent to what Perl does: in particular, from perlre:
and the
/s
modifier: