241 lines
12 KiB
HTML
241 lines
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<META name="generator" content="mm2html (AT&T Research) 2010-09-10">
|
|
<META name="keywords" content="regular expression pattern match regression test">
|
|
<TITLE> ../re/testregex.mm mm document </TITLE>
|
|
<META name="author" content="gsf">
|
|
</HEAD>
|
|
<BODY bgcolor=white link=slateblue vlink=teal >
|
|
<TABLE border=0 align=center width=96%>
|
|
<TBODY><TR><TD valign=top align=left>
|
|
<!--INDEX--><!--/INDEX-->
|
|
<B><FONT size=-1 face="verdana,arial,helvetica,geneva,sans-serif">
|
|
<TABLE align=center cellpadding=2 border=4 bgcolor=lightgrey><TR>
|
|
<TD><A href="testregex.html#Reference Implementations">Reference Implementations</A></TD>
|
|
<TD><A href="testregex.html#Test Data Repository">Test Data Repository</A></TD>
|
|
<TD><A href="testregex.html#Usage">Usage</A></TD>
|
|
<TD><A href="testregex.html#Reference Implementation Notes">Reference Implementation Notes</A></TD>
|
|
<TD><A href="testregex.html#testregex Notes">testregex Notes</A></TD>
|
|
</TR></TABLE>
|
|
</FONT></B>
|
|
<P>
|
|
<HR>
|
|
<CENTER>
|
|
<H3><CENTER><FONT color=red><FONT face=courier>AT&T Research regex(3) regression tests</FONT></FONT></CENTER></H3>
|
|
<BR>Glenn Fowler <SMALL><<A href=mailto:gsf@research.att.com>gsf@research.att.com</A>></SMALL>
|
|
<P><I>AT&T Research - Florham Park NJ</I>
|
|
</CENTER>
|
|
<P><HR><P>
|
|
<A href="testregex.c">testregex.c 2004-05-31</A>
|
|
is the latest source for the AT&T Research regression test
|
|
harness for the
|
|
<A href="http://www.opengroup.org/onlinepubs/007904975/functions/regcomp.html" target=_top>X/Open regex</A>
|
|
pattern match interface.
|
|
See
|
|
<NOBR><A href="http://web.archive.org/~gsf/man/man1/testregex.html"><STRONG>testregex</STRONG></A>(1)</NOBR>
|
|
for option and test input details.
|
|
The source and test data posted here are license free.
|
|
<P>
|
|
<STRONG>testregex</STRONG>
|
|
can:
|
|
<UL type=square>
|
|
<LI>
|
|
verify stability for a particular implementation in the face of
|
|
source code and/or compilation environment changes
|
|
<LI>
|
|
verify standard compliance for all implementations
|
|
<LI>
|
|
provide a basis for discussions on what
|
|
<EM>compliance</EM>
|
|
means
|
|
</UL>
|
|
<P>
|
|
See
|
|
<A href="re-interpretation.html">An Interpretation of the POSIX regex Standards</A>
|
|
for an analysis of the POSIX-X/Open
|
|
<STRONG>regex</STRONG>
|
|
standards.
|
|
<P>
|
|
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="Reference Implementations">Reference Implementations</A></H3></FONT></FONT></CENTER>
|
|
<STRONG>testregex</STRONG>
|
|
is currently built against these reference implementations:
|
|
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
|
|
<TABLE align=center bgcolor=papayawhip border=0 bordercolor=white cellpadding=2 cellspacing=2 frame=void rules=none >
|
|
<TBODY>
|
|
<TR><TD align=right>NAME </TD><TD align=center> LABEL </TD><TD align=left> AUTHORS</TD></TR>
|
|
<TR><TD align=right>
|
|
AT&T ast </TD><TD align=center> <A href="http://www.research.att.com/sw/download/" target=_top>A</A> </TD><TD align=left> Glenn Fowler and Doug McIlroy</TD></TR>
|
|
<TR><TD align=right>
|
|
bsd </TD><TD align=center> <A href="ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-1.5.2/source/sets/src.tgz" target=_top>B</A> </TD><TD align=left> </TD></TR>
|
|
<TR><TD align=right>
|
|
Bell Labs </TD><TD align=center> <A href="http://www.bell-labs.com/" target=_top>D</A> </TD><TD align=left> Doug McIlroy</TD></TR>
|
|
<TR><TD align=right>
|
|
old gnu </TD><TD align=center> <A href="http://www.gnu.org" target=_top>G</A> </TD><TD align=left> </TD></TR>
|
|
<TR><TD align=right>
|
|
gnu </TD><TD align=center> <A href="http://www.gnu.org" target=_top>H</A> </TD><TD align=left> Isamu Hasegawa</TD></TR>
|
|
<TR><TD align=right>
|
|
irix </TD><TD align=center> <A href="http://www.sgi.com" target=_top>I</A> </TD><TD align=left> </TD></TR>
|
|
<TR><TD align=right>
|
|
boost </TD><TD align=center> <A href="http://www.boost.org/libs/regex/" target=_top>J</A> </TD><TD align=left> John Maddock</TD></TR>
|
|
<TR><TD align=right>
|
|
regex++ </TD><TD align=center> <A href="http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm" target=_top>M</A> </TD><TD align=left> John Maddock</TD></TR>
|
|
<TR><TD align=right>
|
|
pcre perl compatible </TD><TD align=center> <A href="http://www.pcre.org/" target=_top>P</A> </TD><TD align=left> Philip Hazel</TD></TR>
|
|
<TR><TD align=right>
|
|
rx </TD><TD align=center> <A href="ftp://regexps.com/pub/src/hackerlab/" target=_top>R</A> </TD><TD align=left> Tom Lord</TD></TR>
|
|
<TR><TD align=right>
|
|
spencer </TD><TD align=center> <A href="http://arglist.com/regex/rxspencer-alpha3.8.g2.tar.gz" target=_top>S</A> </TD><TD align=left> Henry Spencer</TD></TR>
|
|
<TR><TD align=right>
|
|
libtre </TD><TD align=center> <A href="http://kouli.iki.fi/~vlaurika/libtre/" target=_top>T</A> </TD><TD align=left> Ville Laurikari</TD></TR>
|
|
<TR><TD align=right>
|
|
unix caldera </TD><TD align=center> <A href="http://unixtools.sourceforge.net/" target=_top>U</A> </TD><TD align=left> </TD></TR>
|
|
</TBODY></TABLE></TD></TR></TBODY></TABLE>
|
|
<P>
|
|
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="Test Data Repository">Test Data Repository</A></H3></FONT></FONT></CENTER>
|
|
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
|
|
<TABLE align=center bgcolor=papayawhip border=0 bordercolor=white cellpadding=2 cellspacing=2 frame=void rules=none >
|
|
<TBODY>
|
|
<TR><TD align=right>
|
|
<A href="basic.dat">basic.dat</A> </TD><TD align=left> basic regex(3) -- all implementations should pass these</TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="categorize.dat">categorize.dat</A> </TD><TD align=left> <A href="re-categorize.html">implementation categorization</A></TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="nullsubexpr.dat">nullsubexpr.dat</A> </TD><TD align=left> <A href="re-nullsubexpr.html">null (...)* tests</A></TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="leftassoc.dat">leftassoc.dat</A> </TD><TD align=left> <A href="re-assoc.html">left associative catenation implementation must pass these</A></TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="rightassoc.dat">rightassoc.dat</A> </TD><TD align=left> <A href="re-assoc.html">right associative catenation implementation must pass these</A></TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="forcedassoc.dat">forcedassoc.dat</A> </TD><TD align=left> <A href="re-assoc.html">subexpression grouping to force associativity</A></TD></TR>
|
|
<TR><TD align=right>
|
|
<A href="repetition.dat">repetition.dat</A> </TD><TD align=left> <A href="re-repetition.html">explicit vs. implicit repetitions</A></TD></TR>
|
|
</TBODY></TABLE></TD></TR></TBODY></TABLE>
|
|
<P>
|
|
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="Usage">Usage</A></H3></FONT></FONT></CENTER>
|
|
To run the
|
|
<STRONG>basic.dat</STRONG>
|
|
tests:
|
|
<DIV style="padding-left:16px;text-indent:0px">
|
|
<PRE>
|
|
testregex < basic.dat
|
|
</DIV>
|
|
</PRE>
|
|
<P>
|
|
If the local implementation hangs or dumps on some tests then run with
|
|
the <STRONG>-c</STRONG> option.
|
|
The <STRONG>-h</STRONG> option lists the test data format details.
|
|
The test data files exercise all features;
|
|
the test harness detects and ignores features not
|
|
supported by the local implementation.
|
|
<P>
|
|
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="Reference Implementation Notes">Reference Implementation Notes</A></H3></FONT></FONT></CENTER>
|
|
<P>
|
|
<H4><A name="D: diet libc">D: diet libc</A></H4>
|
|
The
|
|
<A href="http://www.fefe.de/dietlibc/" target=_top>diet libc</A>
|
|
implementation is currently omitted because it fails all but one
|
|
<STRONG>basic.dat</STRONG>
|
|
test.
|
|
<P>
|
|
<H4><A name="P: PCRE">P: PCRE</A></H4>
|
|
The
|
|
<STRONG>P</STRONG>
|
|
implementation emulates
|
|
<NOBR><A href="http://web.archive.org/~gsf/man/man1/perl.html"><STRONG>perl</STRONG></A>(1)</NOBR>
|
|
and is not X/Open compliant by design.
|
|
The main differences are:
|
|
<UL type=square>
|
|
<LI>
|
|
<STRONG>P</STRONG>
|
|
<EM>leftmost-first</EM>
|
|
matching as opposed to the X/Open
|
|
<EM>leftmost-longest</EM>.
|
|
<LI>
|
|
<STRONG>REG_EXTENDED</STRONG>
|
|
patterns only.
|
|
</UL>
|
|
<P>
|
|
However, the
|
|
<STRONG>P</STRONG>
|
|
package regression tests, and
|
|
<NOBR><A href="http://web.archive.org/~gsf/man/man1/perl.html"><STRONG>perl</STRONG></A>(1)</NOBR>
|
|
features creeping into other implementations,
|
|
make it reasonable to include here.
|
|
<P>
|
|
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="testregex Notes">testregex Notes</A></H3></FONT></FONT></CENTER>
|
|
Extensions to the standard terminology are derived from the AT&T
|
|
implementation, unified under
|
|
<STRONG><regex.h></STRONG>
|
|
with these modes:
|
|
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
|
|
<TABLE align=center bgcolor=papayawhip border=1 bordercolor=white cellpadding=2 cellspacing=2 frame=box rules=all >
|
|
<TBODY>
|
|
<TR><TD align=center>MODE </TD><TD align=left> FLAGS </TD><TD align=left> DESCRIPTION</TD></TR>
|
|
<TR><TD align=right>
|
|
BRE </TD><TD align=left> 0 </TD><TD align=left> basic RE</TD></TR>
|
|
<TR><TD align=right>
|
|
ERE </TD><TD align=left> REG_EXTENDED </TD><TD align=left> egrep RE with perl (...) extensions</TD></TR>
|
|
<TR><TD align=right>
|
|
ARE </TD><TD align=left> REG_AUGMENTED </TD><TD align=left> ERE with ! negation, <> word boundaries</TD></TR>
|
|
<TR><TD align=right>
|
|
SRE </TD><TD align=left> REG_SHELL </TD><TD align=left> sh patterns</TD></TR>
|
|
<TR><TD align=right>
|
|
KRE </TD><TD align=left> REG_SHELL|REG_AUGMENTED </TD><TD align=left> ksh93 patterns: ! @ ( | & ) { }</TD></TR>
|
|
<TR><TD align=right>
|
|
LRE </TD><TD align=left> REG_LITERAL </TD><TD align=left> fgrep patterns</TD></TR>
|
|
</TBODY></TABLE></TD></TR></TBODY></TABLE>
|
|
<P>
|
|
and a few flags to handle
|
|
<NOBR><A href="http://web.archive.org/~gsf/man/man3/fnmatch.html"><STRONG>fnmatch</STRONG></A>(3):</NOBR>
|
|
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
|
|
<TABLE align=center bgcolor=papayawhip border=1 bordercolor=white cellpadding=2 cellspacing=2 frame=box rules=all >
|
|
<TBODY>
|
|
<TR><TD align=left>regex FLAG </TD><TD align=left> fnmatch FLAG</TD></TR>
|
|
<TR><TD align=left>
|
|
REG_SHELL_ESCAPED </TD><TD align=left> FNM_NOESCAPE</TD></TR>
|
|
<TR><TD align=left>
|
|
REG_SHELL_PATH </TD><TD align=left> FNM_PATHNAME</TD></TR>
|
|
<TR><TD align=left>
|
|
REG_SHELL_DOT </TD><TD align=left> FNM_PERIOD</TD></TR>
|
|
</TBODY></TABLE></TD></TR></TBODY></TABLE>
|
|
<P>
|
|
The original
|
|
<TT>testregex.c</TT>
|
|
was done by Doug McIlroy at Bell Labs.
|
|
The current implementation is maintained by Glenn Fowler <SMALL><<A href=mailto:gsf@research.att.com>gsf@research.att.com</A>></SMALL>.
|
|
<P>
|
|
<HR>
|
|
<TABLE border=0 align=center width=96%>
|
|
<TR>
|
|
<TD align=left></TD>
|
|
<TD align=center></TD>
|
|
<TD align=right><A href="mailto:gsf@research.att.com?subject= ../re/testregex.mm mm document">Glenn Fowler</A></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD align=left></TD>
|
|
<TD align=center></TD>
|
|
<TD align=right>Information and Software Systems Research</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD align=left></TD>
|
|
<TD align=center></TD>
|
|
<TD align=right>AT&T Labs Research</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD align=left></TD>
|
|
<TD align=center></TD>
|
|
<TD align=right>Florham Park NJ</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD align=left></TD>
|
|
<TD align=center></TD>
|
|
<TD align=right>March 22, 2011</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<P>
|
|
|
|
</TD></TR></TBODY></TABLE>
|
|
|
|
</BODY>
|
|
</HTML>
|