TABLE OF CONTENTS

regexp.library/--background--
regexp.library/RegComp
regexp.library/RegFree
regexp.library/RegExec

regexp.library/--background--

    /****************************************************************
     *                    regexp.library                            *
     *                   1998 by M.Bethke                           *
     *                         V37.1                                *
     ****************************************************************/

	regexp.library gives you the functionality of the NetBSD regexp
	package through the standard AmigaOS shared library API.
	Basically it works just like the dos.library pattern matching
	functions (ParsePattern() / MatchPattern()), excpet that instead
	of you providing your own buffer for the parsed expression the
	library allocates one for you which you have to free later. A
	typical call will look like this:

	BOOL MatchStrings(STRPTR pattern, STRPTR string)
	{
	regexp *re;
	LONG result;

	   if(re = RegComp(pattern))
	   {
	      result = RegExec(re,string);
	      if(result == -1)
	      {
	      	result = 0;
	      	Printf("Error matching pattern: #%ld\n",IoErr());
	      }
	   } else Printf("Error compiling pattern: #%ld!\n",IoErr());
	   return (BOOL)result;
	}

	The translation of error codes is given in libraries/regexp.h

regexp.library/RegComp

    NAME
	RegComp -- compile a regular expression to internal format

    SYNOPSIS
	handle = RegComp(Expression)
	D0		 A0

	regexp *RegComp(STRPTR);

    FUNCTION
	RegComp compiles a regular expression to an internal format that the
	actual pattern matcher can understand. It's roughly the equivalent of
	dos.library/ParsePattern() for AmigaDOS patternmatching.

    INPUTS
	Expression = a pointer to the regular expression as a C string

    RESULT
	regexp handle as defines in libraries/regexp.h. The structure of this
	handle is defined in the same include file but should usually not be
	messed with.

    SEE ALSO
	RegFree()

regexp.library/RegFree

    NAME
	RegFree -- free any storage allocated by RegComp().

    SYNOPSIS
	RegFree (Handle)
		 A1

	void RegFree(regexp*);

    FUNCTION
	Frees any storage that RegComp() may have attached to the regexp
	handle it gave you. Basically, RegFree() does nothing more than a
	FreeVec() at the moment but it's there to complete the API and to
	allow future extensions.

    INPUTS
	Handle    = a regexp handle as returned by RegComp()

    RESULT
	nothing

    SEE ALSO
	RegComp()

regexp.library/RegExec

    NAME
	RegExec -- match a regular expression

    SYNOPSIS
	Success = RegExec (Handle,String)
	D0                 A0     A1

	LONG RegExec(regexp*, STRPTR);

    FUNCTION
	This is the actual matching function. It takes a regexp handle and a
	stringpointer and tries to match the expression the handle was created
	from onto the string. A match is indicated by a return value of 1.

    INPUTS
	Handle  = regexp handle as returned by RegComp()
	String  = string to match the expression on

    RESULT
	 1 : Pattern matched string
	 0 : Pattern did not match
	-1 : Failure while matching. IoErr() will return an error number
		  as defined in libraries/regexp.h in this case.

    SEE ALSO
	RegComp(), RegFree()
