perlre

2018-04-30

perlre

Regular expression API using CL-PPCRE and CL-INTERPOL with operators known from sed or perl, m// and s/// plus a similar one, d// for split.

Can be useful for code brevity in regex heavy programs.

idea and code from Doug Hoyte's book Let Over Lambda and quicklisp-package let-over-lambda

Synopsis:

``` (#~s/regex/substitution/imsxge string) (#~m/regex/[modifier] string) (#~d/regex/[modifier] string)

(let ((stg "hanna") (reg "(A)") (sub "\1"))

; output of both is "hanna"

; perlre (#~s/reg/sub/ig stg)

; cl-ppcre (ppcre:regex-replace-all (ppcre:create-scanner reg :case-insensitive-mode t) stg sub)) ``` See test.lisp for other examples.

Author
<schatzer.johann@gmail> using idea and code from LET-OVER-LAMBDA
License
BSD Simplified --- the same as let-over-lambda