;;; sregex.el --- symbolic regular expressions
-;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2016 Free Software Foundation, Inc.
;; Author: Bob Glickstein <bobg+sregex@zanshin.com>
;; Maintainer: Bob Glickstein <bobg+sregex@zanshin.com>
This is exactly like `sregexq' (q.v.) except that it evaluates all its
arguments, so literal sregex clauses must be quoted. For example:
- (sregex '(or \"Bob\" \"Robert\")) => \"Bob\\\\|Robert\"
+ (sregex \\='(or \"Bob\" \"Robert\")) => \"Bob\\\\|Robert\"
An argument-evaluating sregex interpreter lets you reuse sregex
subexpressions:
- (let ((dotstar '(0+ any))
- (whitespace '(1+ (syntax ?-)))
- (digits '(1+ (char (?0 . ?9)))))
- (sregex 'bol dotstar \":\" whitespace digits)) => \"^.*:\\\\s-+[0-9]+\""
+ (let ((dotstar \\='(0+ any))
+ (whitespace \\='(1+ (syntax ?-)))
+ (digits \\='(1+ (char (?0 . ?9)))))
+ (sregex \\='bol dotstar \":\" whitespace digits)) => \"^.*:\\\\s-+[0-9]+\""
(sregex--sequence exps nil))
(defmacro sregexq (&rest exps)
automatically quote its values. Literal sregex clauses must be
explicitly quoted like so:
- (sregex '(or \"Bob\" \"Robert\")) => \"Bob\\\\|Robert\"
+ (sregex \\='(or \"Bob\" \"Robert\")) => \"Bob\\\\|Robert\"
but computed clauses can be included easily, allowing for the reuse
of common clauses:
- (let ((dotstar '(0+ any))
- (whitespace '(1+ (syntax ?-)))
- (digits '(1+ (char (?0 . ?9)))))
- (sregex 'bol dotstar \":\" whitespace digits)) => \"^.*:\\\\s-+[0-9]+\"
+ (let ((dotstar \\='(0+ any))
+ (whitespace \\='(1+ (syntax ?-)))
+ (digits \\='(1+ (char (?0 . ?9)))))
+ (sregex \\='bol dotstar \":\" whitespace digits)) => \"^.*:\\\\s-+[0-9]+\"
Here are the clauses allowed in an `sregex' or `sregexq' expression:
given set. See below for how to construct a CHAR-CLAUSE.
- the symbol `bot'
- Stands for \"\\\\`\", matching the empty string at the beginning of
+ Stands for \"\\\\\\=`\", matching the empty string at the beginning of
text (beginning of a string or of a buffer).
- the symbol `eot'
(provide 'sregex)
-;; arch-tag: 460c1f5a-eb6e-42ec-a451-ffac78bdf492
;;; sregex.el ends here