Re: regex.7 manpage is awful

Petr Baudis
2009-01-09T11:38:53Z

Hi,

On Fri, Jan 09, 2009 at 11:22:09AM +0100, Simon Oosthoek wrote:
> If I were on the POSIX committee, I'd propose perl REs as the next
> "modern" RE, but I'd not obsolete the basic RE at all, because in 95%
> of the uses they are sufficient.
> Perl REs are easy to type, well documented and powerful. Also
> implementations already exist and are very well tested on probably all
> Unix platforms.

I doubt that you will succeed in adding a third regexp mode at this
point, but the POSIX development process seems very open, so feel free
to propose this: http://www.opengroup.org/austin/

> Anyway, the point of this e-mail:
> - the current page is awful, hard to read and ambiguous
> - the implied POSIX decision to obsolete basic REs is bad
> - I would not recommend this manpage to anyone trying to understand
> REs

I agree with most of your points, but I'm sure Michael is aware of the
issues as well - what would probably help were actual patches. ;-)
A random set of working item ideas:

* Don't use modern/obsolete terms since they are unwarranted and
confusing - they seem to push an agenda that has nothing to do
with the reality
* Avoid (!) since they disturb the text severly, IMHO - discuss
extensions at the end; this is something that's even very
difficult to do for me since I don't actually understand many
of the (!)s
* The page should be divided into subsections, with examples
at the end of each subsection
* Atom should be explained before bound
* Back reference should be mentioned before basic regexes
(glibc supports it for ERE too)
* | is supported in BRE too in glibc
* SEE ALSO should have perlre(1) (sic) reference
* The AUTHOR paragraph hidden might violate the page licence?
* Wound boundaries syntax is commented out, but a real one
is supported, using \b, \B, \< and \>
* Plenty of other extensions available too, e.g. \w and \s
(see regcomp.c:peek_token())
* On a related note, re_set_syntax() should be documented

(grep(1) has nice, concise and incomplete regex description.)

--
Petr "Pasky" Baudis
The average, healthy, well-adjusted adult gets up at seven-thirty
in the morning feeling just terrible. -- Jean Kerr