There were some discussions on hackers@ and current@ about BSD grep, but I haven’t yet written anything about it here, so it’s high time to do so. First, you can see here what I have done. As you see, the list of functions is complete. There is P (—perlregexp), which never worked on FreeBSD, but I will try to add this as an optional feature to have a nice and complete grep implementation.
There are some problems, though. GNU accepts non-standard regexes, for example (a|), which has an empty subexpression, while our regex library doesn’t. First, I tried to workaround these in the code, but as I was pointed out later it broke other cases, thus I had to realize that it was not so easy to fix and I needed to remove those workarounds, thus the problem still persists. I’ve looked at our regex library a bit. It was written by Henry Spencer. He has a new version of his library but that version still has the same behaviour. I’ve been told about the PCRE library, which has a POSIX-compatible interface. I realized that in fact it’s just the interface, the interpretation of the expressions in still Perl-like. Solutions are still needed…