pcre.pir - user interface to Perl-Compatible Regular Expression library
load_bytecode 'pcre.pbc' .local pmc func, lib func = get_hll_global ['PCRE'], 'init' lib = func() func = get_hll_global ['PCRE'], 'compile' ( regex, error, errptr )= func( pat, options ) func = get_hll_global ['PCRE'], 'match' ( ok, result )= func( regex, string, start, options ) func = get_hll_global ['PCRE'], 'dollar' match = func( string, ok, result, i )
This is the user interface to PCRE. Use this to initialize the library, compile regexes, match against strings, and return the results. All functions are found in the 'PCRE' namespace.
The NCI interface is contained in libpcre.pir.
Initialize the pcre library. The library handle is returned as a PMC and is additionally stored as global 'PCRE', 'lib'.
Compile the string pattern with int options. Returns pmc regex, string error and int errptr.
Match the pmc regex against string string from int start with int options. Returns the number of matches in int ok and the ovector in pmc result.
Extract from string string the int ith result into string match. Returns the match.
None known, but this hasn't been well tested. This interface is designed to work on all platforms where PCRE and parrot are supported, but has not been tested on all of them. Send bug reports to <email@example.com<gt>
Original code by Leo Toetsch, updated by Jerry Gay <jerry dot gay at gmail dot com<gt>