[relaxng-user] ANN: RNV 1.5.2

David Tolpin dvd at davidashen.net
Thu Jan 29 02:47:17 ICT 2004


> http://davidashen.net/rnv.html
> 
>    Two ways to use extension datatype libraries are implemented for RNV;

Forgot to mention: a Scheme implementation of XML Schema regular expressions
is a part of the distribution; it makes possible to conveniently debug
regular expressions by writing:

(define addr-spec-regex
  (let* (
      (atom "[a-zA-Z0-9!#$%&'*+\\-/=?\\^_`{|}~]+")
      (person "\"([^"\\\\]|\\\\.)\"")
      (location "\\[([^\\[\\]\\\\]|\\\\.)*\\]")

      (domain (string-append atom "(\\." atom ")*")))

    (string-append
      "(" domain "|" person ")"
      "@"
      "(" domain "|" location ")")))

...

(rx-match (rx-compile addr-spec-regex) s)

instead of:

    pattern=
      "(\(([^\(\)\\]|\\.)*\) )?"
    ~ "([a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+"
    ~ "(\.[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+)*"
    ~ """|"([^"\\]|\\.)*")"""
    ~ "@"
    ~ "([a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+"
    ~ "(\.[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+)*"
    ~ "|\[([^\[\]\\]|\\.)*\])"
    ~ "( \(([^\(\)\\]|\\.)*\))?"

David Tolpin


More information about the relaxng-user mailing list