compiled regex and ends-with

Q&A's, tips, howto's
Locked
jopython
Posts: 123
Joined: Tue Sep 14, 2010 3:08 pm

compiled regex and ends-with

Post 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"


Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: compiled regex and ends-with

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

jopython
Posts: 123
Joined: Tue Sep 14, 2010 3:08 pm

Re: compiled regex and ends-with

Post by jopython »

Thank you Lutz. newLisp has one of the best documentation for any Lisps I have seen around.

Locked