.th REGCMP I 5/31/77 .sh NAME regcmp \*- regular expression compile .sh SYNOPSIS .bd regcmp [\-] file ... .sh DESCRIPTION .it Regcmp, in most cases, precludes the need for calling .it regcmp (see .it regex\^\c (III)) from C programs. This saves on both execution time and program size. The command .it regcmp compiles the regular expressions in .it file and places the output in .it file.i\c \&. If the ``\*-'' option is used, the output will be placed in .it file.c. .s3 The format of entries in .it file is a name (\c C variable), followed by one or more blanks, followed by a regular expression enclosed in double quotes. The output of .it regcmp is C source, which declares each variable name as an .it "extern char" array, and initializes that array with the compiled form of the corresponding regular expression. .it File.i files may thus be .it included into C programs, or .it file.c files may be compiled and later loaded. Diagnostics are self-explanatory. .s3 .ne 10 Example: .s3 .in +5n .nf .lp +15 10 name "([A\*-Za\*-z][A\*-Za\*-z0\*-9\_]*)$0" .lp +15 10 telno "\\\\({0,1}([2\*-9][01][1\*-9])$0\\\\){0,1} *" "([2\*-9][0\*-9]{2})$1[ \*-]{0,1}" "([0\*-9]{4})$2" .i0 .fi .s3 In the C program which uses the .it regcmp output, .s3 .in +5n regex(telno, line, area, exch, rest) .in -5n .s3 will apply the regular expression named .it telno to .it line. .i0 .sh "SEE ALSO" regex(III)