All Projects → fukamachi → re21

fukamachi / re21

Licence: other
CL21's spin-off project that provides neat APIs for regular expressions.

Programming Languages

common lisp
692 projects

RE21

Quicklisp dist

RE21 is CL21's spin-off project that provides neat APIs for regular expressions.

Usage

(use-package :re21)

(re-match "^Hello, (.+?)!$" "Hello, World!")
;=> "Hello, World!"
;   #("World")

(re-match "^(\\d{4})-(\\d{2})-(\\d{2})$" "2016-01-06")
;=> "2016-01-06"
;   #("2016" "01" "06")

(re-groups "(\\w+)\\s+(\\w+)\\s+(\\d{1,2})\\.(\\d{1,2})\\.(\\d{4})"
           "Frank Zappa 21.12.1940")
;=> ("Frank" "Zappa" "21" "12" "1940")

(re-split "-" "2016-01-06")
;=> ("2016" "01" "06")

(re-replace "a" "Eitaro Fukamachi" "α" :global t)
;=> "Eitαrow Fukαmαchi"
;   T

;; Enable the syntax for regular expressions
(syntax:use-syntax :re21)

(#/^Hello, (.+?)!$/ "Hello, World!")
;=> "Hello, World!"
;   #("World")

(#/^(\d{4})-(\d{2})-(\d{2})$/ "2014-01-23")
;=> "2014-01-23"
;   #("2014" "01" "23")

(re-replace #/a/g "Eitaro Fukamachi" "α")
;=> "Eitαro Fukαmαchi"
;   T

Installation

cd ~/common-lisp
git clone https://github.com/fukamachi/re21
(ql:quickload :re21)

Credits

License

RE21 is free and unencumbered software released into the public domain.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].