Page 1 of 1

compiled regex and ends-with

Posted: Sat Jun 15, 2013 1:48 am
by jopython
Is it possible to use compiled regex with the ends-with function?

Code: Select all

(set 'dt (regex-comp {(\w+)}))

(ends-with "delta" dt 0x10000)  => ERR: regular expression in function ends-with : "error -4 when executing"


Re: compiled regex and ends-with

Posted: Sat Jun 15, 2013 1:42 pm
by Lutz
ends-with will not work with compiled regex patterns because it internally appends a $ (end of text) character to the pattern. If the pattern is already compiled that causes an error. But starts-with and others will work, as they do not change the pattern internally.

This will be added to the documentation.

Re: compiled regex and ends-with

Posted: Mon Jun 17, 2013 1:54 am
by jopython
Thank you Lutz. newLisp has one of the best documentation for any Lisps I have seen around.