You see, Unix C has had regular expressions - regcomp and regex - for
quite a few iterations now. I remembered that there had been some
discussions regarding whether the AT&T regex were adequate, and whether
a different version of regular expressions should really be used.
Apparently, because of these discussions, no regular-expression
routines were included in the ANSI C library definition!
However, there apparently IS a definition of regex - regcomp and regex
- in the IEEE 1003.2 (POSIX interface). I find that Henry Spencer has
written a package to that standard. Henry has been doing Unix almost
as long as I have; perhaps longer. When he does things, he does them
"right!" - at least, per his own particular philosophy, with which I
find myself very often in agreement. In this particular case, he
implemented the standard exactly as written, pointing out its flaws
along the way. His code is based on Berkeley regex. It's incompatible
with Unix V8 regexp.
GNU, in typical GNU fashion, decided to solve all possible problems at
once in their version. Their version, "rx", apparently offers the
following different regular-expression syntaxes:
EMACS awk POSIX awk grep
egrep POSIX egrep sed
POSIX basic POSIX minimal basic
POSIX extended POSIX minimal extended
Although I don't find any documentation on it anywhere on my installed
system, this is apparently the version delivered with my Linux system
(Slackware).
Which is better? GNU probably can do things that Henry's wouldn't even
dream of. However, you'd better find the documentation - and it's
likely to be extensive, since there are a LOT of options. Henry's is
probably a good bit smaller and does exactly what it's defined to do
(even when the definition is incorrect). You decide.
Bottom line? C _does_ have regular expressions, and has had for a long
time. ANSI C doesn't include it in the definition, though; so I
wouldn't be surprised if some PC compiler that's better at a touchy-
feely interface than at real work didn't include it.
--
Joe Yao js...@cais.com - Joseph S. D. Yao