File: README.textile

package info (click to toggle)
regex-clojure 1.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 212 kB
  • sloc: xml: 45; makefile: 24; sh: 17
file content (26 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
net.cgrand.regex is a Clojure notation (DSL) for regexes.

Regexes are already a DSL of their own but a write-only DSL. 

This DSL allows to reuse regexes or parts of them and also adds support for named groups.

This project started as a toy/lab for the DSL course at "Conj Labs Brussels":http://conj-labs.eu back in June 2010.

h1. Example

<pre>
  (def datestamp-re
    (let [d {\0 \9}]
      (regex [d d d d :as :year] \- [d d :as :month] \- [d d :as :day])))
      
  regex=> (exec datestamp-re "2007-10-23")
  {:day "23", :month "10", :year "2007", nil "2007-10-23"}
  regex=> (exec datestamp-re "20X7-10-23")
  nil
</pre>  

h1. License

Copyright © 2010-2013 Christophe Grand

Distributed under the Eclipse Public License, the same as Clojure.