Package COM.INFORMATIMAGO.COMMON-LISP.REGEXP.REGEXP-POSIX


NOT COMPLETE YET.

This package implement POSIX Regular Expressions in Common-Lisp.
This is interesting because it's available on any Common-Lisp platform
while external C regexp libraries or internals are available or not,
and not always implement these same syntax or semantic.


Posix Regexp implemented in Common-Lisp.

See specifications at:
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap09.html

This is a strict implementation that will work both in clisp
(Common-Lisp) and emacs (with cl and pjb-cl Common-Lisp extensions).

This implementation is entirely in lisp, contrarily to what regexp
packages are available under clisp or emacs.  Thus it has the advantage
of portability and availability (you don't have to compile or link
a lisp system written in some barbarous language, and you get the same
regexp features in all programs including this module).


License:

    AGPL3
    
    Copyright Pascal J. Bourguignon 2002 - 2012
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
    
    You should have received a copy of the GNU Affero General Public License
    along with this program.
    If not, see <http://www.gnu.org/licenses/>

match
structure
This structure stores a (start,end) couple specifying the range matched
by a group (or the whole regexp).
(match regexp string &optional start end)
function
Common-Lisp: This function returns as first value a match structure
containing the indices of the start and end of the first match for the
regular expression REGEXP in STRING, or nil if there is no match.
If START is non-nil, the search starts at that index in STRING.
If END is non-nil, only (subseq STRING START END) is considered.
The next values are match structures for every '(...)' construct in REGEXP,
in the order that the open parentheses appear in REGEXP.


start:   the first character of STRING to be considered (defaults to 0)
end:     the after last character of STRING to be considered
         (defaults to (length string)).
RETURN:  index of start of first match for REGEXP in STRING, nor nil.

MATCH-END

MATCH-START

(match-string string match)
function
Extracts the substring of STRING corresponding to a given pair of
start and end indices. The result is shared with STRING.
If you want a freshly consed string, use copy-string
or (coerce (match-string ...) 'simple-string).

RE-NSUB

(regcomp pattern &key extended ignore-case nosub newline)
function
RETURN:  A regex-t representing the compiled regular expression PATTERN.
RAISE:   An ERROR condition, in case of syntax error.
regex-t
structure
NSUB:  Number of parenthesized subexpressions.
(regexec regex string &key nmatch bol eol)
function
RETURN:  match ;
         (or (not match) (null nmatch) (zerop nmatch) (re-nosub regex)) ==> nil
         (eq t nmatch) ==> A vector of regmatch-t with (1+ (re-nsub regex))
                           items
         (numberp nmatch) ==> A vector of regmatch-t with nmatch items.
WARNING: Entry #0 of the result vector is always the start and end of the
         whole expression.  To get the start and end of the last subexpression
         you need to pass :nmatch (1+ (re-nsub regex)) [or T].

REGEXP-QUOTE

regmatch-t
structure
SO:  Byte offset from start of string to start of substring.
EO:  Byte offset from start of string of the first character
     after the end of substring.
regoff-t
type
The type regoff_t shall be defined as a signed integer type that
can hold the largest value that can be stored in either a type off_t
or type ssize_t. 

RM-EO

RM-SO

size-t
type
Used for sizes of objects.