[cl-ppcre-devel] empty line matches with cl-ppcre

Jan Rychter jan at rychter.com
Wed Jul 14 06:35:28 UTC 2004


> 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.






More information about the Cl-ppcre-devel mailing list