Which regular expression libraries should I use in

2019-03-31 14:11发布

问题:

I'm trying to learn Common Lisp and want to use regular expressions for parsing a text file. Which library is the easiest to use for a beginner like me? Am I right in assuming it depends on which implementation of Common Lisp I'm using? I see some promising Google results, but I thought it wouldn't hurt to see if I can get some good advice from the Lispers out there. Thanks!

回答1:

For the beginner just use CL-PPCRE. It is fast, robust and stable, and works fine on any implementation.

There's also a small trick to make working with it more pleasant - adding a nickname of RE besides PPCRE.

(rename-package "CL-PPCRE" "CL-PPCRE" '("PPCRE" "RE"))

So you'll be able to use it this way: (re:scan ...