2 * regcomp and regexec - front ends to re_ routines
4 * Mostly for implementation of backward-compatibility kludges. Note
5 * that these routines exist ONLY in char versions.
7 * Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
9 * Development of this software was funded, in part, by Cray Research Inc.,
10 * UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
11 * Corporation, none of whom are responsible for the results. The author
14 * Redistribution and use in source and binary forms -- with or without
15 * modification -- are permitted for any purpose, provided that
16 * redistributions in source form retain this entire copyright notice and
17 * indicate the origin and nature of any modifications.
19 * I'd appreciate being given credit for this package in the documentation
20 * of software which uses it, but that is not a requirement.
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
25 * HENRY SPENCER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 - regcomp - compile regular expression
41 regcomp(re
, str
, flags
)
50 len
= re
->re_endp
- str
;
55 return re_comp(re
, str
, len
, f
);
59 - regexec - execute regular expression
62 regexec(re
, str
, nmatch
, pmatch
, flags
)
74 start
= str
+ pmatch
[0].rm_so
;
75 len
= pmatch
[0].rm_eo
- pmatch
[0].rm_so
;
82 return re_exec(re
, start
, len
, nmatch
, pmatch
, f
);