Questions tagged [cl-ppcre]

CL-PPCRE - Portable Perl-compatible regular expressions for Common Lisp

CL-PPCRE is a portable regular expression library for Common Lisp which has the following features:

  • It is compatible with Perl.
  • It is pretty fast.
  • It is portable between ANSI-compliant Common Lisp implementations.
  • It is thread-safe.
  • In addition to specifying regular expressions as strings like in Perl you can also use S-expressions.
  • It comes with a BSD-style license so you can basically do with it whatever you want.

See also the official homepage.

8 questions
5
votes
1 answer

Wrong regex match using cl-ppcre?

Trying to parse the following text file: prefix1 prefix2 name1( type1 name1, type2 name2 ); with following regex: \\s*prefix1\\s*prefix2\\s*(\\w[\\w\\d_]*).*\\(\\s*([^\\)]*\\))\\s*;\\s* as a…
avp
  • 4,895
  • 4
  • 28
  • 40
3
votes
2 answers

Matching end-of-line with CL-PPCRE

I've a rather simple regex that works perfectly fine in my Ruby code but refuses to work in my Lisp code. I'm just trying to match a URL (slash followed by a word, and no more). Here's the regex I have that works in Ruby: ^\/\w*$ I'd like this to…
Sunder
  • 63
  • 4
3
votes
2 answers

cl-ppcre:regex-replace and backslashes in replacement

May be this questions is really stuped, but I'm stuck. How can I put backslashes in cl-ppcre:regex-replace-all replacement? For example I just want to escape some characters like ' " ( ) etc, so I'm going to do with | replacement first, to see that…
sheikh_anton
  • 3,422
  • 2
  • 15
  • 23
3
votes
1 answer

Extracting a regex match in common lisp

I must be missing something very basic here. I need to extract a capture group from a match in common lisp. When I eval in the interpreter (an sbcl implementation): `(cl-ppcre::scan-to-strings ".*?(\\d).png" "sample1.png")` I…
ealfonso
  • 6,622
  • 5
  • 39
  • 67
2
votes
2 answers

Correcting the regex "\[([a-zA-Z0-9_-]+)]"

The following cl-ppcre regular expression generates an error: (ppcre:scan-to-strings "\[([a-zA-Z0-9_-]+)]" "[has-instance]") debugger invoked on a CL-PPCRE:PPCRE-SYNTAX-ERROR in thread #: Expected end of…
davypough
  • 1,847
  • 11
  • 21
2
votes
2 answers

Run an ABCL code that uses cl-cppre

With reference to my previous question, Executing a lisp function from Java I was able to call lisp code from Java using ABCL. But the problem is, the already existing lisp code uses CL-PPCRE package. I can not compile the code as it says 'CL-PPCRE…
1
vote
1 answer

Escaping quotes in cl-ppcre regex

Background I need to parse CSV files, and cl-csv et. al. are too slow on large files, and have a dependency on cl-unicode, which my preferred lisp implementation does not support. So, I am improving cl-simple-table, one that Sabra-on-the-hill…
CL-USER
  • 715
  • 3
  • 9
0
votes
2 answers

CL-PPCRE Unicode Property

I am trying to find a solution to this simple Perl code using the CL-PPCRE Library: if (/\p{Space}/){ print "This string has some spaces\n"; } I am a newbie to CL-PPCRE and tried: (scan "\\p{\\#Space}" "The String has some white spaces") ; I…