Should be fixed now. Please try.
CL-USER> (cl-ppcre:regex-replace-all (cl-ppcre:create-scanner "^$" :multi-line-mode t) *str* "!")
Thank you -- indeed, it is fixed. It now produces:
JWR-TEST> (cl-ppcre:regex-replace-all (cl-ppcre:create-scanner "(?m)^$") *str* "!")
"1 2 3 ! 4 !"
I guess it is debatable whether the last "!" should be there. Perl doesn't behave that way, but I guess it _is_ an empty line, now that I think of it. And I wanted to get "!" instead of empty lines. So it actually makes more sense than Perl.
It's shorter to write
(cl-ppcre:regex-replace-all "(?m)^$" *str* "!")
instead. This will also allow the compiler macro to compile the regex at load time.
Nice, thanks!
--J.